Snippet List
Some INSTALLED_APPLICATIONS applications may not be critical for your website to work - for example you may only need them for development - like 'django_extensions' or 'debug_toolbar'. They needn't be installed actually for the site to work.
This way you can avoid discussions with other developers if some application should be included, or is it just spam, because if they don't like it, they don't have to install it.
On a production server you can leave this not installed, to avoid security concerns like a possibility to IP-spoof and see the debug toolbar.
- configuration
- settings
- conditional
- installed_apps
This is a conditional templatetag decorator that makes it *very* easy to write template tags that can be used as conditions. This can help avoid template boilerplate code (e.g. setting a variable in your template to be used in a condition).
All you have to do is define a function with expected parameters that returns True or False. Examples are in the code.
- template
- tag
- templatetag
- if
- conditional
- condition
- else
- endif
This tag allow you to use C-like switch tag in your templates.
It is useful for sequencial and repetitive `{% ifequal %}` tags.
To install it in your project, you just need to follow [these instructions](http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system)
- tag
- conditional
- switch
- case
Cheers to limodou for getting me thinking about this. The only problem with his implementation is that it doesn't support Django's "." syntax for accessing array/dict elements. In the Django style of allowing simple syntax for designers while allowing for greater flexibility, and less template duplication for conditionals that were previously impossible to represent in templates, I modified Django's built-in If tag.
This is an adaptation/enhancement to Django's built in IfNode {% if ... %} that combines if ifequal ifnotequal into one and then adds even more. This
Supports
1. ==, !=
2. not ....
3. v in (1,"y",z)
4. <=, <, >=, >
5. nesting (True and (False or (True or False)))
How to use it:
{% pyif i == 1 or (5 >= i and i != 7) and user.first_name in ('John', 'Jacob') %}
'Tis true.
{% else %}
'Tis false.
{% endif %}
I hope you like it.
- template
- tag
- templatetag
- if
- conditional
- ifequal
- ifnotequal
4 snippets posted so far.