dvnrsn
1
I’m a little confused because I’m getting a literal render of this line I copied from tutorial
{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize
}}
The first two are interpreted but the last one is rendering literally in the browser without evaluating beforehand. I see
4 vote{{ choice.votes|pluralize }}
Django version 4.1.2
Please copy a larger context of your template - perhaps 3-4 lines on each side of this line.
dvnrsn
3
{% for choice in question.choice_set.all %}
<li>
{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize
}}
</li>
{% endfor %}
Ok this is literally copied and pasted from tutorial (to my code). What’s interesting is if I supply an integer the pluralize works.
The formatting here shows the closing braces on a separate line. Is that the case in your template or an artifact of posting it here?
Newlines are not allowed within tags.
dvnrsn
5
Hmm yes thank you that seems to be the issue. Something to do with format on save with black / autopep8a or prettier in VS Code