dnscms: improve venue selection for event occurrences

This commit is contained in:
2026-05-26 01:57:04 +02:00
parent 089970a5cd
commit ec94d82863
2 changed files with 38 additions and 1 deletions
+10 -1
View File
@@ -478,7 +478,7 @@ class EventOccurrence(Orderable):
),
FieldRowPanel(
children=[
FieldPanel("venue", heading=_("Venue")),
FieldPanel("venue", heading=_("Venue"), widget=forms.Select),
FieldPanel("venue_custom", heading=_("Venue as free text")),
],
),
@@ -492,6 +492,15 @@ class EventOccurrence(Orderable):
]
def clean(self):
if self.venue_custom:
trimmed = self.venue_custom.strip()
self.venue_custom = trimmed
if trimmed:
match = VenuePage.objects.filter(title=trimmed).first()
if match:
self.venue = match
self.venue_custom = ""
if self.venue and self.venue_custom:
raise ValidationError(
{