remotes/origin/upgrade-requirements
parent
cf9b7b2ec2
commit
b06fba71f4
2 changed files with 16 additions and 3 deletions
@ -0,0 +1,12 @@ |
||||
from django import template |
||||
register = template.Library() |
||||
|
||||
@register.assignment_tag |
||||
def query(qs, **kwargs): |
||||
""" template tag which allows queryset filtering. Usage: |
||||
{% query books author=author as mybooks %} |
||||
{% for book in mybooks %} |
||||
... |
||||
{% endfor %} |
||||
""" |
||||
return qs.filter(**kwargs) |
||||
Loading…
Reference in new issue