Answers for "djago objects filter"

0

filtering objects in django templates

@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 %}
Posted by: Guest on June-10-2021
7

objects.filter django

>>> Entry.objects.filter(blog_id=4)
Posted by: Guest on September-03-2020
0

filtering objects in django templates

{% for category in categories %}
  {% for thing in things|in_category:category %}
    {{ thing }}
  {% endfor %}
{% endfor %}
Posted by: Guest on June-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language