From 0dafda30e4f66e2db39756a71545ad86a8e6a075 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 19 Oct 2024 17:55:32 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20la=20navigation=20dans?= =?UTF-8?q?=20la=20partie=20administration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/models.py | 3 +++ src/agenda_culturel/static/style.scss | 10 +++++----- .../templates/agenda_culturel/moderation.html | 10 ++++++++-- .../templates/agenda_culturel/page-rimport.html | 3 ++- src/agenda_culturel/views.py | 10 ++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 3106142..9e610e5 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1391,6 +1391,9 @@ class RecurrentImport(models.Model): null=True, ) + def __str__(self): + return self.name + def nb_imports(self): return BatchImportation.objects.filter(recurrentImport=self).count() diff --git a/src/agenda_culturel/static/style.scss b/src/agenda_culturel/static/style.scss index 3eab92a..6431e03 100644 --- a/src/agenda_culturel/static/style.scss +++ b/src/agenda_culturel/static/style.scss @@ -1252,7 +1252,11 @@ article { } } -form.messages div { +form.messages div, form.moderation-events { + @media only screen and (min-width: 992px) { + display: grid; + grid-template-columns: repeat(2, 50%); + } fieldset { float: left; margin-right: 1em; @@ -1261,8 +1265,4 @@ form.messages div { clear: both; float: left; } - div { - display: inline-block; - margin-right: 1em; - } } \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/moderation.html b/src/agenda_culturel/templates/agenda_culturel/moderation.html index f63439c..2c3a23c 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderation.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderation.html @@ -20,10 +20,16 @@

Derniers événements soumis

-
- {{ filter.form }}
+ + {{ filter.form.as_div }}

+ {% if filter.form.import_sources.value %} + +
+ {% endif %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-rimport.html b/src/agenda_culturel/templates/agenda_culturel/page-rimport.html index 79e0ac9..f436df7 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-rimport.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-rimport.html @@ -18,8 +18,9 @@
- < Retour + < Tous les imports récurrents
+ Voir les événements {% picto_from_name "calendar" %} Exécuter {% picto_from_name "download-cloud" %} Éditer {% picto_from_name "edit" %} Supprimer {% picto_from_name "trash" %} diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 2d8aa5a..11ce8ee 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -875,6 +875,16 @@ class EventFilterAdmin(django_filters.FilterSet): choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple ) + import_sources = django_filters.ModelChoiceFilter( + label="Importé depuis", + method="filter_by_source", + queryset=RecurrentImport.objects.all().order_by("name__unaccent") + ) + + def filter_by_source(self, queryset, name, value): + src = RecurrentImport.objects.get(pk=value.pk).source + return queryset.filter(import_sources__contains=[src]) + class Meta: model = Event fields = ["status"]