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; margin-left: 1em;
font-size: 90%; font-size: 90%;
margin-top: -0.5em; 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" %} {% extends "agenda_culturel/page.html" %}
{% block title %}Tous les événements{% endblock %} {% block title %}Derniers événements soumis{% endblock %}
{% comment %} {% load cat_extra %}
TODO: {% block entete_header %}
* améliorer le rendu ici {% css_categories %}
{% endcomment %} {% endblock %}
{% block content %} {% block content %}
<h1>Derniers événements soumis</h1> <article>
<article> <header>
<details> <h1>Derniers événements soumis</h1>
<summary>Filtrer et trier</summary>
<section> <form method="get" class="form django-form recent">
<form method="get" class="form django-form"> {{ filter.form }}<br />
{{ filter.form }}<br /> <button type="submit">Filtrer</button><br />
<button type="submit">Filtrer</button><br /> </form>
</form> </header>
</section>
</details> <ul>
<ul>
{% for obj in paginator_filter %} {% 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 %} {% endfor %}
</ul> </ul>
<footer> <footer>

View File

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

View File

@ -370,24 +370,12 @@ class EventSubmissionFormView(FormView):
class EventFilterAdmin(django_filters.FilterSet): class EventFilterAdmin(django_filters.FilterSet):
tags = django_filters.CharFilter(lookup_expr='icontains') status = django_filters.MultipleChoiceFilter(choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple)
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'),
),
)
class Meta: class Meta:
model = Event model = Event
fields = ['title', 'status', 'category', 'tags'] fields = ['status']
@login_required(login_url="/accounts/login/") @login_required(login_url="/accounts/login/")
def event_list(request): def event_list(request):
@ -402,7 +390,7 @@ def event_list(request):
except EmptyPage: except EmptyPage:
response = paginator.page(paginator.num_pages) 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): class SimpleSearchEventFilter(django_filters.FilterSet):