diff --git a/src/agenda_culturel/templates/agenda_culturel/place_detail.html b/src/agenda_culturel/templates/agenda_culturel/place_detail.html
index 5a70700..e319247 100644
--- a/src/agenda_culturel/templates/agenda_culturel/place_detail.html
+++ b/src/agenda_culturel/templates/agenda_culturel/place_detail.html
@@ -65,10 +65,20 @@
{% get_current_language as LANGUAGE_CODE %}
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
- {% cache cache_timeout place_list user.is_authenticated object page_obj.number %}
-
+ {% cache cache_timeout place_list user.is_authenticated object page_obj.number past %}
+
{% if object_list %}
- Événements du lieu
+ {% if past %}
+ Événements passés
+ {% else %}
+ Événements à venir
+ {% endif %}
{% include "agenda_culturel/navigation.html" with page_obj=page_obj %}
diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py
index adf74f8..36ab98f 100644
--- a/src/agenda_culturel/urls.py
+++ b/src/agenda_culturel/urls.py
@@ -142,6 +142,7 @@ urlpatterns = [
),
path("404/", page_not_found, name="page_not_found"),
path("500/", internal_server_error, name="internal_server_error"),
+ path("place//", PlaceDetailView.as_view(), name="view_place_past"),
path("place/", PlaceDetailView.as_view(), name="view_place"),
path("place//edit", PlaceUpdateView.as_view(), name="edit_place"),
path("place//delete", PlaceDeleteView.as_view(), name="delete_place"),
diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py
index 5ba45db..3dad4c8 100644
--- a/src/agenda_culturel/views.py
+++ b/src/agenda_culturel/views.py
@@ -1725,11 +1725,18 @@ class PlaceDetailView(ListView):
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")
+ logger.warning(self.kwargs)
+ self.past = "past" in self.kwargs
+ if self.past:
+ return Event.objects.filter(exact_location=self.place).filter(start_day__lte=datetime.now()).order_by("-start_day")
+ else:
+ return Event.objects.filter(exact_location=self.place).filter(start_day__gte=datetime.now()).order_by("start_day")
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["object"] = self.place
+ context["past"] = self.past
return context