On améliore le rendu de l'administration

This commit is contained in:
Jean-Marie Favreau 2023-11-11 14:25:14 +01:00
parent eb0b9965d7
commit 235662bb11
4 changed files with 31 additions and 35 deletions

View File

@ -328,4 +328,11 @@ article#filters {
margin-left: 1em;
font-size: 90%;
margin-top: -0.5em;
}
.form.recent {
#id_status>div {
display: inline-block;
margin-right: 2em;
}
}

View File

@ -1,28 +1,27 @@
{% extends "agenda_culturel/page.html" %}
{% block title %}Tous les événements{% endblock %}
{% block title %}Derniers événements soumis{% endblock %}
{% comment %}
TODO:
* améliorer le rendu ici
{% endcomment %}
{% load cat_extra %}
{% block entete_header %}
{% css_categories %}
{% endblock %}
{% block content %}
<h1>Derniers événements soumis</h1>
<article>
<details>
<summary>Filtrer et trier</summary>
<section>
<form method="get" class="form django-form">
{{ filter.form }}<br />
<button type="submit">Filtrer</button><br />
</form>
</section>
</details>
<ul>
<article>
<header>
<h1>Derniers événements soumis</h1>
<form method="get" class="form django-form recent">
{{ filter.form }}<br />
<button type="submit">Filtrer</button><br />
</form>
</header>
<ul>
{% for obj in paginator_filter %}
<li><a href="{{ obj.get_absolute_url }}">{{ obj }}</a></li>
<li>{% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=obj %}</li>
{% endfor %}
</ul>
<footer>

View File

@ -1,7 +1,9 @@
{% load utils_extra %}
{% load cat_extra %}
{% load event_extra %}
<p>{{ event.category | small_cat }}
{{ event|picto_status }}
<a href="{{ event.get_absolute_url }}">
{% if event.title_hl %}{{ event.title_hl | safe }}{% else %}{{ event.title }}{% endif %}</a></p>
<p class="subentry-search">{% picto_from_name "calendar" %}
@ -17,5 +19,5 @@
{% endfor %}
</p>
<div class="description">
{% if event.description_hl %}{{ event.description_hl | safe }}{% else %}{{ event.description }}{% endif %}
{% if event.description_hl %}{{ event.description_hl | safe }}{% else %}{% if event.description %}{{ event.description }}{% else %}<em>pas de description</em>{% endif %}{% endif %}
</div>

View File

@ -370,24 +370,12 @@ class EventSubmissionFormView(FormView):
class EventFilterAdmin(django_filters.FilterSet):
tags = django_filters.CharFilter(lookup_expr='icontains')
o = django_filters.OrderingFilter(
# tuple-mapping retains order
fields=(
('created_date', 'created_date'),
('modified_date', 'modified_date'),
('status', 'status'),
('title', 'title'),
('start_day', 'start_day'),
),
)
status = django_filters.MultipleChoiceFilter(choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple)
class Meta:
model = Event
fields = ['title', 'status', 'category', 'tags']
fields = ['status']
@login_required(login_url="/accounts/login/")
def event_list(request):
@ -402,7 +390,7 @@ def event_list(request):
except EmptyPage:
response = paginator.page(paginator.num_pages)
return render(request, 'agenda_culturel/list.html', {'filter': filter, 'paginator_filter': response})
return render(request, 'agenda_culturel/recently-added.html', {'filter': filter, 'paginator_filter': response})
class SimpleSearchEventFilter(django_filters.FilterSet):