Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
템플릿 쿼리조회 옵션불가 해결
# 템플릿 쿼리조회 옵션불가 해결
@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
You can’t perform that action at this time.