Skip to content

Instantly share code, notes, and snippets.

@hwshim0810
Created June 15, 2017 06:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hwshim0810/c2b13e4121bd62b5705a72a7e7295a46 to your computer and use it in GitHub Desktop.
템플릿 쿼리조회 옵션불가 해결
# 템플릿 쿼리조회 옵션불가 해결
@register.filter
def in_category(things, category):
return things.filter(category=category)
# 템플릿에
{% for category in categories %}
{% for thing in things|in_category:category %}
{{ thing }
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment