From 4c9ab1ff2300e03735779073ccba9846a7da3ebc Mon Sep 17 00:00:00 2001 From: Giuseppe De Ponte Date: Wed, 1 Sep 2021 12:34:10 +0200 Subject: [PATCH] feat: add creation date filter to person/people admin list --- agir/people/admin/panels.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agir/people/admin/panels.py b/agir/people/admin/panels.py index cef9fb6193..425f30d577 100644 --- a/agir/people/admin/panels.py +++ b/agir/people/admin/panels.py @@ -22,6 +22,7 @@ from django.utils.html import format_html, format_html_join from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ +from rangefilter.filters import DateRangeFilter from agir.authentication.models import Role from agir.elus.models import types_elus @@ -101,7 +102,7 @@ class TagListFilter(AutocompleteFilter): class AnimateMoreThanOneGroup(admin.SimpleListFilter): - title = "Cette personne annime plus d'un groupe d'action" + title = "Cette personne anime plus d'un groupe d'action" parameter_name = "Person who animate more than one group" def lookups(self, request, model_admin): @@ -213,6 +214,7 @@ class PersonAdmin(DisplayContactPhoneMixin, CenterOnFranceMixin, OSMGeoAdmin): "gender", TagListFilter, AnimateMoreThanOneGroup, + ("created", DateRangeFilter), ) inlines = (RSVPInline, MembershipInline, EmailInline) @@ -223,6 +225,7 @@ class PersonAdmin(DisplayContactPhoneMixin, CenterOnFranceMixin, OSMGeoAdmin): # mais n'est en réalité pas utilisé pour déterminer les champs # de recherche search_fields = ["search", "contact_phone"] + date_hierarchy = "created" def get_search_results(self, request, queryset, search_term): if search_term: