Skip to content
Snippets Groups Projects

fixed registration form

Merged Luko van der Maas requested to merge fix/registrationFieldsAdmin into master
1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
+ 9
5
@@ -15,11 +15,15 @@ class RegistrationAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance.event.has_fields():
self.fields['fields'].initial = (
reverse('admin:events_registration_fields',
args=[self.instance.pk]))
else:
try:
if self.instance.event.has_fields():
self.fields['fields'].initial = (
reverse('admin:events_registration_fields',
args=[self.instance.pk]))
else:
self.fields['fields'].widget = self.fields[
'fields'].hidden_widget()
except Event.DoesNotExist:
self.fields['fields'].widget = self.fields[
'fields'].hidden_widget()
Loading