ajout champ disciplinaire, modif ordre champs de recherche
[auf_beco.git] / project / scholarships / filters.py
1 # -*- encoding: utf-8 -*-
2
3 from django_filters.filterset import FilterSet
4 from django_filters.filters import RangeFilter, CharFilter
5 from django.utils.translation import ugettext_lazy as _
6
7 from project.scholarships.models import Scholarship
8 from project.utils.extra_filters import AutoCompleteFilter
9
10 class ScholarshipFilter(FilterSet):
11 class Meta:
12 model = Scholarship
13 fields = ['scholarship_type', 'year_accepted', 'sender_institution', 'sender_town', 'sender_country',
14 'beneficiary',
15 'sender_office', 'sender_department',
16 'receiver_office', 'receiver_institution', 'receiver_department', 'receiver_town', 'receiver_country',
17 'supported_duration_count', 'supported_amount',
18 'title', 'disciplines', 'champ_disciplinaire', 'comments']
19
20 beneficiary = AutoCompleteFilter(channel = "betterscholarship_receiver", label = _(u"Bénéficiaire"))
21 year_accepted = RangeFilter(label = _(u"Année d'acceptation"))
22 sender_institution = AutoCompleteFilter(channel = "institution_university", label = _(u"Etablissement d'origine"))
23 sender_department = AutoCompleteFilter(channel = "department", label = _(u"Faculté d'origine"))
24 sender_town = CharFilter(lookup_type = "icontains", label = _(u"Ville d'origine"))
25
26 receiver_institution = AutoCompleteFilter(channel = "institution_university", label = _(u"Etablissement d'accueil"))
27 receiver_department = AutoCompleteFilter(channel = "department", label = _(u"Faculté d'accueil"))
28 receiver_town = CharFilter(lookup_type = "icontains", label = _(u"Ville d'accueil"))
29
30 # supported_duration_count = RangeFilter(label = _(u"Durée financée"))
31 # supported_amount = RangeFilter(label = _(u"Montant financé"))
32 # title = CharFilter(lookup_type = "icontains", label = _(u"Titre"))
33
34 # disciplines = AutoCompleteFilter(channel = "discipline", label = _(u"Disciplines"))
35 # comments = CharFilter(lookup_type = "icontains", label = _(u"Commentaire"))
36