Opened 4 years ago

Closed 4 years ago

#16939 closed Bug (fixed)

Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide

Reported by: julien Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Two sections (see [1] and [2]) of the custom template tag howto guide illustrate an obsolete implementation (6 years old! -- see r1964) of the built-in {% comment %} tag. Those should be updated either to reflect the new implementation (see in [3]) or to provide a different example.



[3] source:django/trunk/django/template/

Attachments (1)

r17141-howto-custom-template-tags-comment.diff (1.6 KB) - added by sebastian 4 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 4 years ago by sebastian

  • Has patch set

Here is an attempt at updating the documentation. It still keeps the actual {% comment %} example since I think it's still valid, but adds a note highlighting the differences to the actual implementation.

I still like the simplified {% comment %} example because it leads to the more elaborate {% upper %} tag in the following section. First we parse the node list but simply ignore it, later we actually use it and run a transformation on it.

Coming up with a completely new introductory example seems not necessary, and with the note regarding the actual implementation of {% comment %} it should be clear that this is only an example, usually one would still use the standard {% comment %} tag for actually commenting out template code.

(The note has the added effect of introducing parser.skip_past() which I wasn't aware of until now. – Slightly unrelated, the patch also fixes a missing period in the single-sentence documentation of the actual {% comment %} tag.)

Changed 4 years ago by sebastian

comment:2 Changed 4 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin
  • Version changed from 1.3 to SVN

comment:3 Changed 4 years ago by SmileyChris

  • Resolution set to fixed
  • Status changed from new to closed

In [17663]:

Fixed #16939 -- Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide. Thanks sebastian for the patch.

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