middleware for user_passes_test
Middleware to decorate views with user_passes_test in a centralized, url-matching manner. Makes it easy to apply permissions across large sections or all of a site.
- auth
- permissions
- decorators
Middleware to decorate views with user_passes_test in a centralized, url-matching manner. Makes it easy to apply permissions across large sections or all of a site.
A filter that re.matches a regex against a value. Useful for nav bars as follows: {% if location.path|match:"/$" %} class="current"{% endif %} For `location.path` see my [location context_processor](/snippets/1685/).
A simple context_processor to include location info. Useful for permalinks, site name references, and navigation bars. For example: {% if location.path|match:"/$" %} class="current"{% endif %} See also my [match filter](/snippets/1686/).
I use this filter quite a bit to keep my templates less cluttered. Instead of: {%if some_variable%}, {{some_variable}}{%endif%} I can write: {{some_variable|format:", %s"}} A common one I use is: {{some_variable|format:"<p>%s</p>"}}
gsf0 has posted 4 snippets.