Amélioration de la navigation dans la partie administration

This commit is contained in:
Jean-Marie Favreau 2024-10-19 17:55:32 +02:00
parent 44eeac19c2
commit 0dafda30e4
5 changed files with 28 additions and 8 deletions

View File

@ -1391,6 +1391,9 @@ class RecurrentImport(models.Model):
null=True, null=True,
) )
def __str__(self):
return self.name
def nb_imports(self): def nb_imports(self):
return BatchImportation.objects.filter(recurrentImport=self).count() return BatchImportation.objects.filter(recurrentImport=self).count()

View File

@ -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 { fieldset {
float: left; float: left;
margin-right: 1em; margin-right: 1em;
@ -1261,8 +1265,4 @@ form.messages div {
clear: both; clear: both;
float: left; float: left;
} }
div {
display: inline-block;
margin-right: 1em;
}
} }

View File

@ -20,10 +20,16 @@
<header> <header>
<h1>Derniers événements soumis</h1> <h1>Derniers événements soumis</h1>
<form method="get" class="form django-form recent"> <form method="get" class="form django-form recent moderation-events">
{{ filter.form }}<br /> {{ filter.form.as_div }}<br />
<button type="submit">Filtrer</button><br /> <button type="submit">Filtrer</button><br />
</form> </form>
{% if filter.form.import_sources.value %}
<div class="slide-buttons">
<a href="{% url 'view_rimport' filter.form.import_sources.value %}" role="button">Voir l'import récurrent {% picto_from_name "chevron-right" %}</a>
</div>
<div style="clear: both"></div>
{% endif %}
</header> </header>
<div> <div>

View File

@ -18,8 +18,9 @@
<div class="grid two-columns"> <div class="grid two-columns">
<article> <article>
<header> <header>
<a href="{% url 'recurrent_imports' %}" role="button">&lt; Retour</a> <a href="{% url 'recurrent_imports' %}" role="button">&lt; Tous les imports récurrents</a>
<div class="buttons slide-buttons"> <div class="buttons slide-buttons">
<a href="{% url 'moderation' %}?import_sources={{ object.pk }}" role="button">Voir les événements {% picto_from_name "calendar" %}</a>
<a href="{% url 'run_rimport' object.pk %}" role="button">Exécuter {% picto_from_name "download-cloud" %}</a> <a href="{% url 'run_rimport' object.pk %}" role="button">Exécuter {% picto_from_name "download-cloud" %}</a>
<a href="{% url 'edit_rimport' object.pk %}" role="button">Éditer {% picto_from_name "edit" %}</a> <a href="{% url 'edit_rimport' object.pk %}" role="button">Éditer {% picto_from_name "edit" %}</a>
<a href="{% url 'delete_rimport' object.pk %}" role="button">Supprimer {% picto_from_name "trash" %}</a> <a href="{% url 'delete_rimport' object.pk %}" role="button">Supprimer {% picto_from_name "trash" %}</a>

View File

@ -875,6 +875,16 @@ class EventFilterAdmin(django_filters.FilterSet):
choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple 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: class Meta:
model = Event model = Event
fields = ["status"] fields = ["status"]