I'm using this code (in forms.py) for my custom signup form for allauth:
class RegistrationForm(UserCreationForm):
birth_date = forms.DateField(widget=extras.SelectDateWidget(years=BIRTH_DATE_YEARS))
class Meta:
model = get_user_model()
fields = ('username', 'email', 'password1', 'password2', 'first_name', 'last_name', 'gender', 'birth_date', 'city', 'country')
I have of course specified ACCOUNT_SIGNUP_FORM_CLASS
in settings.py to point to this form and it displays the fields which I've put in it. However, it does not work on submission, even if I put signup
method it never gets invoked. I've tried with the save
but still it's the same - it raises an error that one of my custom added fields is blank while creating user and saving it to the database.
So, what's the correct code for achieving this?