Login

Snippets by fragsworth

Snippet List

Easy Conditional Template Tags

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

fragsworth has posted 1 snippet.