Commit c6eec194 authored by Élie Bouttier's avatar Élie Bouttier

filtrer les adhésions par status d’import des données

parent 174d609f
......@@ -91,6 +91,23 @@ class AdherentTypeFilter(admin.SimpleListFilter):
return queryset.filter(corporation__isnull=False)
class AdhesionImportedFilter(admin.SimpleListFilter):
title = 'données importées'
parameter_name = 'imported'
def lookups(self, request, model_admin):
return (
('0', 'Non'),
('1', 'Oui'),
def queryset(self, request, queryset):
if self.value() == '0':
return queryset.exclude(notes="")
if self.value() == '1':
return queryset.filter(notes="")
### Mixins
class AdtSearchMixin:
......@@ -221,7 +238,7 @@ class CorporationAdmin(AdtSearchMixin, admin.ModelAdmin):
class AdhesionAdmin(AdtSearchMixin, admin.ModelAdmin):
list_display = ('get_id', 'type', 'get_adherent_link', 'is_active')
list_filter = (AdherentTypeFilter, ActiveFilter)
list_filter = (AdherentTypeFilter, ActiveFilter, AdhesionImportedFilter)
list_select_related = ('user', 'user__profile', 'corporation',)
fields = ('id', 'type', 'get_adherent_link', 'get_membership_link', 'get_antennas_link',)
readonly_fields = ('id', 'type', 'get_adherent_link', 'get_membership_link', 'get_antennas_link',)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment