Dans la vue par places, on affiche la version représentative
This commit is contained in:
parent
d0195612f0
commit
dafadecd23
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user