This is the difference between a filter or simple_tag and an assignment_tag. Definitely agree that if performance is a consideration, this is more cleanly accomplished with an assignment tag.
It's not a bad point but isn't templatetags (that take in the request for context) there to inject content into the template? With template context processors you get *information* which you then deliberately insert into the template when you will.
I don't even know what an "assignment_tag" is. I've been living in Jinja-land so long that maybe this is a newfangled feature in modern Django templates.
Comment
This is the difference between a filter or simple_tag and an assignment_tag. Definitely agree that if performance is a consideration, this is more cleanly accomplished with an assignment tag.
Parent comment
It's not a bad point but isn't templatetags (that take in the request for context) there to inject content into the template? With template context processors you get *information* which you then deliberately insert into the template when you will.
Replies
I don't even know what an "assignment_tag" is.
I've been living in Jinja-land so long that maybe this is a newfangled feature in modern Django templates.
Even though it was already possible to write such a tag before assignment_tag is indeed a pretty new feature it's only 3 years old https://docs.djangoproject.com/en/1.8/releases/1.4/#assignment-template-tags