I\'m using this code (in forms.py) for my custom signup form for allauth:
class RegistrationForm(UserCreationForm):
birth_date = forms.DateField(widget=extra
In your project setting.py try to add this line:
verify if you have added this:
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
)
ACCOUNT_SIGNUP_FORM_CLASS = "yourapp.forms.customSignupForm"
In app.models
class CustomModel(models.Model):
"""CustomModel docstring."""
city = forms.CharField(max_length=75)
country = forms.CharField(max_length=25)
other....
In app.forms:
class SignForm(forms.ModelForm):
"""SignForm docstring."""
username = forms.CharField(
max_length=30,
)
first_name = forms.CharField(
max_length=30,
)
last_name = forms.CharField(
max_length=30,
)
field...
def myclean():
def signup(self, request, user):
"""You signup function."""
# dont forget to save your model
class Meta:
model = mymodel.CustomModel
fields = [
'city',
'country',
'field...',
]
Try this method work !