From 32201ecd437d8c39c7699a22d774a5458c1d2fb2 Mon Sep 17 00:00:00 2001
From: Jean-Marie Favreau
Date: Wed, 1 May 2024 15:06:02 +0200
Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20UC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Ajout d'une liste des événements par lieu
- Correction de quelques défauts d'affichage
---
.../agenda_culturel/ephemeris-inc.html | 2 +-
.../templates/agenda_culturel/navigation.html | 15 +++++++++++++++
.../agenda_culturel/place_detail.html | 18 ++++++++++++++++--
.../templates/agenda_culturel/place_list.html | 18 +++---------------
.../single-event/event-in-flat-list-inc.html | 10 +++++++---
.../single-event/event-in-list-inc.html | 2 +-
src/agenda_culturel/views.py | 14 +++++++++++++-
7 files changed, 56 insertions(+), 23 deletions(-)
create mode 100644 src/agenda_culturel/templates/agenda_culturel/navigation.html
diff --git a/src/agenda_culturel/templates/agenda_culturel/ephemeris-inc.html b/src/agenda_culturel/templates/agenda_culturel/ephemeris-inc.html
index 8430cd7..5615870 100644
--- a/src/agenda_culturel/templates/agenda_culturel/ephemeris-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/ephemeris-inc.html
@@ -4,7 +4,7 @@
{% if event.is_single_day %}
{{ event.start_day |date:"l" }}
{{ event.start_day |date:"j" }}
- {{ event.start_day |date:"F" }}
+ {{ event.start_day |date:"F" }}{% if with_year %} {{ event.start_day |date:"Y" }}{% endif %}
{% if event.start_time %}
- {% if event.has_recurrences %}
+ {% if not no_location %}
+ {% picto_from_name "map-pin" %}
+ {% if event.location_hl %}{{ event.location_hl | safe }}{% else %}{% include "agenda_culturel/event-location-inc.html" with event=event %}{% endif %}
+ {% endif %}
+ {% if event.has_recurrences %}
{% picto_from_name "repeat" %}
@@ -26,6 +28,7 @@
{% endif %}
{% endif %}
+ {% if event.tags %}
{% picto_from_name "tag" %}
{% for tag in event.tags %}
@@ -33,6 +36,7 @@
{% if not forloop.last %}, {% endif %}
{% endfor %}
+ {% endif %}
{% if event.description_hl %}{{ event.description_hl | safe }} [...]{% else %}{% if event.description %}{{ event.description |truncatewords:60 }}{% else %}
pas de description{% endif %}{% endif %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
index 89b4666..188bfae 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
@@ -5,7 +5,7 @@
{% load tag_extra %}
- {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
+ {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter with_year=with_year %}
{{ event.category | small_cat_recurrent:event.has_recurrences }}
{% if event.location or event.exact_location %}{% endif %}
diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py
index 12b9308..60a9fb5 100644
--- a/src/agenda_culturel/views.py
+++ b/src/agenda_culturel/views.py
@@ -1126,8 +1126,20 @@ class PlaceListView(ListView):
ordering = ['name__unaccent']
-class PlaceDetailView(DetailView):
+class PlaceDetailView(ListView):
model = Place
+ template_name = "agenda_culturel/place_detail.html"
+ paginate_by = 10
+
+ def get_queryset(self):
+ self.place = get_object_or_404(Place, pk=self.kwargs['pk'])
+ return Event.objects.filter(exact_location=self.place).order_by("-start_day")
+
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context['object'] = self.place
+ return context
+
class UpdatePlaces:
def form_valid(self, form):