Les événements sans localisation sont ceux qui en ont vraiment besoin

This commit is contained in:
Jean-Marie Favreau 2024-11-07 19:33:52 +01:00
parent 3cdb6cdaf9
commit cb69ece6ca
3 changed files with 5 additions and 2 deletions

View File

@ -649,6 +649,9 @@ class Event(models.Model):
def nb_draft_events(): def nb_draft_events():
return Event.objects.filter(status=Event.STATUS.DRAFT).count() return Event.objects.filter(status=Event.STATUS.DRAFT).count()
def get_qs_events_with_unkwnon_place():
return Event.objects.filter(exact_location__isnull=True).filter(~Q(status=Event.STATUS.TRASH)).filter(Q(possibly_duplicated=None)|Q(masked=False))
def download_image(self): def download_image(self):
# first download file # first download file

View File

@ -78,7 +78,7 @@ def show_badges_events(placement="top"):
@register.simple_tag @register.simple_tag
def show_badge_unknown_places(placement="top"): def show_badge_unknown_places(placement="top"):
nb_unknown = Event.objects.filter(exact_location__isnull=True).count() nb_unknown = Event.get_qs_events_with_unkwnon_place().count()
if nb_unknown != 0: if nb_unknown != 0:
return mark_safe( return mark_safe(
'<a href="' '<a href="'

View File

@ -1982,7 +1982,7 @@ class UnknownPlacesListView(PermissionRequiredMixin, ListView):
paginate_by = 10 paginate_by = 10
ordering = ["-pk"] ordering = ["-pk"]
template_name = "agenda_culturel/place_unknown_list.html" template_name = "agenda_culturel/place_unknown_list.html"
queryset = Event.objects.filter(exact_location__isnull=True) queryset = Event.get_qs_events_with_unkwnon_place()
def fix_unknown_places(request): def fix_unknown_places(request):