core: make SignUpForm’s fields readonly if there is an initial value
This commit is contained in:
parent
7f2bae4c2c
commit
111b0ec4fb
|
@ -50,6 +50,10 @@ class SignUpForm(forms.Form):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# All fields which have initial data supplied are set to read only
|
||||
if 'initial' in kwargs:
|
||||
for field, _ in kwargs.get('initial').items():
|
||||
self.fields[field].widget.attrs['readonly'] = 'readonly'
|
||||
# TODO: Dynamically add captcha here
|
||||
# if not Setting.get_bool('recaptcha:enabled'):
|
||||
# self.fields.pop('captcha')
|
||||
|
|
Reference in a new issue