1. Curtis Maloney
  2. gnocchi-catalogue

Source

gnocchi-catalogue / catalogue / templatetags / catalogue.py

from django import template
from gnocchi_catalogue import models

register = template.Library()

@register.filter
def products_with_tags(values):
    qset = models.Product.objects.all()
    for tag in values.split():
        qset = qset.filter(tags__tag__name=tag.strip())
    return qset