From 5cef80d58c33d24d3af23a22b5d88537e57dcb1b Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 18 Jan 2021 13:07:07 +0100 Subject: [PATCH] Subevent creation: Pre-fill name and location from event --- src/pretix/control/forms/subevents.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pretix/control/forms/subevents.py b/src/pretix/control/forms/subevents.py index db5afb264..d90d6c82b 100644 --- a/src/pretix/control/forms/subevents.py +++ b/src/pretix/control/forms/subevents.py @@ -22,6 +22,12 @@ from pretix.helpers.money import change_decimal_field class SubEventForm(I18nModelForm): def __init__(self, *args, **kwargs): self.event = kwargs['event'] + instance = kwargs.get('instance') + if instance and not instance.pk: + kwargs['initial'].setdefault('name', self.event.name) + kwargs['initial'].setdefault('location', self.event.location) + kwargs['initial'].setdefault('geo_lat', self.event.geo_lat) + kwargs['initial'].setdefault('geo_lon', self.event.geo_lon) super().__init__(*args, **kwargs) self.fields['location'].widget.attrs['rows'] = '3'