Login

Tag "template tag"

Snippet List

Smart Spaceless

This 'smart_spaceless' template tag is a replacement for Django's built-in 'spaceless'. If settings.DEBUG = True, spaces will not be removed to make debugging your template code easier. When DEBUG = False, spaces will be removed. Happy coding!

  • template
  • spaceless
  • template tag
  • remove spaces
  • template tags
Read More

Template Tag for Retrieving complex Settings

Very much like the snippet joshua wrote (http://djangosnippets.org/snippets/67/) for the same purpose but with the addition that this lets the user get values for more complex settings like dicts and lists

  • settings
  • template tag
Read More

Add CSS class template filter

Sometimes you want to add CSS classes to HTML elements that are generated by Django using their `__unicode__` representation, eg. you can output a form field with `{{ form.name }}`, but if you would like to add a certain CSS class to the outputted input or select tag you would have to assort to plain HTML. Using this filter you can simply do something like `{{ form.name|add_class:"span-4" }}` which will render an input like `<input type="..." name="..." class="span-4`.

  • django
  • template tag
  • css class
  • template filter
Read More

3 snippets posted so far.