#17348: Implement {% elif %} in the template language ---------------------------------+------------------------------------ Reporter: aaugustin | Owner: nobody Type: New feature | Status: new Component: Template system | Version: SVN Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+------------------------------------ Changes (by aaugustin):
* needs_better_patch: => 0 * version: => SVN * stage: Unreviewed => Accepted * needs_tests: => 0 * needs_docs: => 0 Comment: #3100 is about supporting arguments on intermediate tag tokens, and it's a pre-requisite for this ticket. Here are the arguments I saw on IRC. Pros: - templates should be able to express presentational logic: for instance, depending of an object's state, I want to show different properties - the most straightforward workaround is messy: `{% if a %} ... {% else %}{% if b %} ... {% else %}{% if c %} ... {% endif %}{% endif %}{% endif %}` - a more elaborate workaround involves partial templates, e.g. `{% include myobj.state_template %}` where state_template returns `"partials/state_<STATE>.html"`, but that's overkill for simple cases Cons: - templates shouldn't contain too much logic — that's a well understood design choice - increasing the amount of logic in the templates doesn't help us fight performance issues Tentatively marking as accepted, please bump back to DDN if you disagree. -- Ticket URL: <https://code.djangoproject.com/ticket/17348#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.