Login

Snippets by slafs

Snippet List

Filter by first letter inclusion tag

My first snippet ;] It's a simple inclusion tag for filtering a list of objects by a first letter using [django-filter](http://github.com/alex/django-filter) after having this "installed" you can use it in your template like this: {% load my_tags %} <div class="letter_filter"> Filter by first letter: {% letters_filter "MyNiceModel" %} </div> for information how to use django-filter in your view go to [docs](http://github.com/alex/django-filter/blob/master/docs/usage.txt) you should probably cache this inclusion tag since it makes 45 queries to the db (.count() > 0) Enjoy and improve ;] PS. some parts of this code are in Polish

  • filter django-filter inclusion tag first-letter
Read More

slafs has posted 1 snippet.