PyCharm reports error when using pipes in Django template

已回答

When using the filtering operator (|) in a Django template this way:

<p>Rendered text with {{ pub_date|date:"c" }}</p>

PyCharm reports an error saying it expects double closing brackets after the key (in this case "date").

This is correct syntax. How can I make it go away?

0
正式评论

Hello.

Please check you have "Django" template language set in "templates" settings

Avatar
Permanently deleted user

Thank you! That was it. For some reason it was set as Jinja2 (is this the default template?).

0

请先登录再写评论。