1 # -*- coding: utf-8 -*-
3 # This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
7 from django.forms.widgets import TextInput
8 from django.utils.translation import ugettext_lazy as _
10 from catalogue.filters import tag_filter
11 from organizations.models import Organization
14 class OrganizationFilterSet(django_filters.FilterSet):
15 name = django_filters.CharFilter(
16 lookup_expr='icontains', label='',
17 widget=TextInput(attrs={'placeholder': _('name')}))
18 subject = tag_filter('subject')
24 def filter_by_tag(self, queryset, name, value):
27 return queryset.filter(document__tags__in=value).distinct()