forms: Save realm_creation setting on RegistrationForm.

This will be useful for making the checking behavior depend on the
status of this form.
This commit is contained in:
Vishnu Ks
2017-10-04 23:45:43 +00:00
committed by Tim Abbott
parent 4ddb812354
commit 07438b2f2c

View File

@@ -80,7 +80,7 @@ class RegistrationForm(forms.Form):
# Since the superclass doesn't except random extra kwargs, we
# remove it from the kwargs dict before initializing.
realm_creation = kwargs['realm_creation']
self.realm_creation = kwargs['realm_creation']
del kwargs['realm_creation']
super(RegistrationForm, self).__init__(*args, **kwargs)
@@ -88,7 +88,7 @@ class RegistrationForm(forms.Form):
self.fields['terms'] = forms.BooleanField(required=True)
self.fields['realm_name'] = forms.CharField(
max_length=Realm.MAX_REALM_NAME_LENGTH,
required=realm_creation)
required=self.realm_creation)
def clean_full_name(self):
# type: () -> Text