#7711: Implement a tag "Switch" for conditional rendering
---------------------------------------------------+------------------------
Reporter: GabrielFalcao | Owner: nobody
Status: new | Milestone:
Component: Template system | Version: SVN
Keywords: case switch tags template templatetag | Stage: Unreviewed
Has_patch: 1 |
---------------------------------------------------+------------------------
Django is kinda pythonic and mostly of conditional tags implemented are
what mostly people would need:
{{{
{% if %}, {% ifequal %}, {% ifnotequal %} and so...
}}}
But i think that sometimes a "switch tag" would be great!
So i've implemented it, and attached the patch with this ticket
The implementation can be used as this:
{{{
{% switch person.name %}
{% case "John Doe" %}
My name is Doe, John Doe
{% endcase %}
{% case "Mary Jane" %}
My name is Mary Jane
{% endcase %}
{% default %}
OMG! I have no name!
{% endswitch %}
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/7711>
Django Code <http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---