diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 7d3571a..a1ad956 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -58,7 +58,7 @@ from django.utils import timezone from django.utils.html import escape from datetime import date, timedelta from django.utils.timezone import datetime -from django.db.models import Q, Subquery, OuterRef, Count +from django.db.models import Q, Subquery, OuterRef, Count, F from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ @@ -2021,7 +2021,10 @@ 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).filter(start_day__gte=datetime.now()).order_by("start_day") + return Event.objects.filter(exact_location=self.place).filter( + Q(other_versions__isnull=True) | + Q(other_versions__representative=F('pk')) | + Q(other_versions__representative__isnull=True)).filter(start_day__gte=datetime.now()).order_by("start_day") def get_context_data(self, **kwargs):