class ChercheurAdmin(admin.ModelAdmin):
list_filter = ['genre']
- list_per_page = 9999
+ alphabet_filter = 'nom'
+ alphabet_filter_table = 'chercheurs_personne'
+ DEFAULT_ALPHABET = ''
+
actions = ('remove_from_group', 'export_as_ods', 'export_as_csv')
search_fields = ('nom', 'prenom')
def lookup_allowed(self, lookup, value):
return lookup in ['genre', 'statut', 'membre_reseau_institutionnel',
'membre_instance_auf', 'discipline', 'region', 'pays',
- 'groupes', 'nord_sud', 'initial'] or \
+ 'groupes', 'nord_sud'] or \
admin.ModelAdmin.lookup_allowed(self, lookup, value)
def remove_from_group(self, request, queryset):
except Chercheur.DoesNotExist:
return None
- def changelist_view(self, request, extra_context=None):
- initials = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- current_initial = request.GET.get('initial', 'A')
- return super(ChercheurAdmin, self).changelist_view(request, extra_context={
- 'initials': initials,
- 'current_initial': current_initial
- })
-
def export(self, queryset, type):
if queryset.count() == 0:
return None
region = kwargs.pop('region', None)
nord_sud = kwargs.pop('nord_sud', None)
expert = kwargs.pop('expert', None)
- initial = kwargs.pop('initial', 'A')
- qs = super(ChercheurAdminQuerySet, self).filter(nom__istartswith=initial)
+ qs = self
if pays is not None:
qs = qs.filter(Q(etablissement__pays=pays) |
(Q(etablissement=None) & Q(etablissement_autre_pays=pays)))
# coding: utf-8
-from urllib import urlencode
-
from django import template
from django.utils.encoding import smart_unicode
-from chercheurs.models import Chercheur, Groupe, GENRE_CHOICES, STATUT_CHOICES
+from chercheurs.models import Groupe, GENRE_CHOICES, STATUT_CHOICES
from datamaster_modeles.models import Region, Pays
from savoirs.models import Discipline
'query_string': cl.get_query_string({query_param: k}, remove),
'display': v})
return result
-
-@register.simple_tag
-def query_string_with_initial(request, initial):
- qs = request.GET.copy()
- qs['initial'] = initial
- return urlencode(qs)