Login

Tag "case"

Snippet List

Case Insensitive Authentication Backend

By enabling this backend: AUTHENTICATION_BACKENDS = ( 'path.to.my.backends.CaseInsensitiveModelBackend', ) Your users will now be able to log in with their username, no matter whether the letters are upper- or lower-case.

  • auth
  • case
  • case-insensitive
  • backend
  • insensitive
Read More

Switch/case conditional tags

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
Read More

Switch/case tags.

Meant mostly as a demo of how to do complex block tags, here's a switch/case implementation. It's deliberately simplistic: no default cases, no multiple values for the same case, etc. This is so that you can focus on the technique. Pay particular attention to how both switch and case pull out their child nodes and save them for later rendering. This is a very useful technique for these types of "structured" template tags.

  • templatetag
  • switch
  • case
  • flow
  • logic-doesnt-belong-in-templates
Read More

3 snippets posted so far.