Login

Snippets by robcharlwood

Snippet List

Class based view decorator

Converts a passed decorator to one that can be applied to a class based view (ie. automatically decorates dispatch). This means no more overriding dispatch for every view / request method you want to apply decorators to. Works in Django 1.3 but I suspect it probably works in 1.2 as well.

  • django
  • generic-views
  • decorator
  • class-based-views
Read More

Custom Template Tag - No Translate

Forces Django not to translate built in template tags and filters. If you have a multi-lingual site but certain parts of it are not all translated, you can use this snippet to force Django to bypass translation on all template tags and filters so things like dates aren't randomly translated whilst everything else is not. For example: `{% notrans %}{{download.doc|filesizeformat}}{% endnotrans %}` This snippet including the filesizeformat template tag would not be translated. Mega thanks goes out to Dan Fairs for all his help on this!

  • translation
  • multi-lingual
  • custom-template-tags
Read More

robcharlwood has posted 2 snippets.