Opened 3 hours ago

Last modified 2 hours ago

#36758 new Uncategorized

Template parser — at Initial Version

Reported by: Stephen Skett Owned by:
Component: Template system Version: 4.2
Severity: Normal Keywords: template, filter, pipe, whitespace, divisibleby, center
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Based on discussion from previous support ticket #4746, I believe it should now be possible to add whitespace around the pipe-character when using a filter in a Django-template, if that is stylistically preferred.

However, I experience 'TemplateSyntaxError' when I use whitespace around the '|', specifically the built-in divisibleby filter - as in the following example:

{% for obj in some_collection %}
  {% if forloop.counter0 | divisibleby:num_items_per_row %}
    {% comment %}Some HTML here...{% endcomment %}
  {% endif %}
{% endfor %}

I don't seem to encounter this error for any of the other built-in template-filters which I commonly use (e.g. date, floatformat, etc.), or with custom filters in my tag-libraries. Is this a bug with divisibleby, or am I missing something?

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top