On corrige l'affichage des événements déjà soumis

This commit is contained in:
Jean-Marie Favreau 2024-09-21 21:04:56 +02:00
parent 67469cf339
commit 3dd4b02e5b

View File

@ -9,6 +9,7 @@ from django.contrib.auth.mixins import (
from django.http import QueryDict
from django import forms
from django.contrib.postgres.search import SearchQuery, SearchHeadline
from django.utils.safestring import mark_safe
from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse
@ -672,8 +673,6 @@ class URLEventEvaluation:
return self.exists() and self.existing is None
def is_event_visible(self):
if not self.is_new():
return False
return self.event is not None
def get_event(self):
@ -706,10 +705,10 @@ def import_from_urls(request):
# for each not new, add a message
for uc in ucat:
if uc.exists() and not uc.is_new():
if uc.is_event_visible():
if uc.is_event_visible(): # TODO
messages.info(
request,
_('{} has not been submitted since it''s already known: {}.').format(uc.url).format(uc.get_link())
mark_safe(_('{} has not been submitted since it''s already known: {}.').format(uc.url, uc.get_link()))
)
else:
messages.info(
@ -761,7 +760,7 @@ def import_from_url(request):
if uc.is_event_visible():
messages.info(
request,
_('{} has not been submitted since it''s already known: {}.').format(uc.url).format(uc.get_link())
mark_safe(_('{} has not been submitted since it''s already known: {}.').format(uc.url, uc.get_link()))
)
return HttpResponseRedirect(uc.get_event().get_absolute_url())
else:
@ -1585,7 +1584,6 @@ def apply_categorisation_rules(request):
nb = 0
for epk, c in form.get_validated():
e = Event.objects.get(pk=epk)
logger.warning("cat " + c)
cat = Category.objects.get(name=c)
e.category = cat
e.save()