From 22c895b3a24f64b3f18eeaa9db8651e9643aa2f8 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Wed, 1 May 2024 15:23:06 +0200 Subject: [PATCH] Fix erreur 500 si pas d'alias --- src/agenda_culturel/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 5057b9b..90b9e7f 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -209,7 +209,10 @@ class Place(models.Model): return Event.objects.filter(exact_location=self).count() def match(self, event): - return event.location in self.aliases + if self.aliases: + return event.location in self.aliases + else: + return False def associate_matching_events(self): u_events = Event.objects.filter(exact_location__isnull=True)