aqszzFollowed instructions as on [the page][1]. to customize user profile while using django-allauth. Django/python saying it can't find the "SignupForm" class definition, which is clearly defined in the file forms.py in the users app as in the code below. Anyone has any idea what's going on?
forms.py
from django import forms
from allauth.account.forms import AddEmailForm, BaseSignupForm
from django.core.exceptions import ValidationError
from django.conf import settings
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import CustomUser
class SignupForm(BaseSignupForm):
first_name = forms.CharField(max_length=30, label='Firstname')
last_name = forms.CharField(max_length=150, label='Lastname')
def signup(self, request, user):
user.first_name = self.cleaned_data['first_name']
user.last_name = self.cleaned_data['last_name']
user.save()
class MyAddEmailForm(AddEmailForm):
def clean_email(self):
email = super().clean_email()
if self.user.emailaddress_set.count() >= settings.USERS_EMAILS_MAX_COUNT:
raise ValidationError('Number of related emails can be no more than %d.' % settings.USERS_EMAILS_MAX_COUNT)
return email
class CustomUserCreationForm(UserCreationForm):
class Meta:
model = CustomUser
fields = (...)
class CustomUserChangeForm(UserChangeForm):
class Meta:
model = CustomUser
fields = (...)
Error message is:
File "D:\Python\Django\m4ever\users\admin.py", line 4, in <module>
from .forms import CustomUserCreationForm, CustomUserChangeForm
File "D:\Python\Django\m4ever\users\forms.py", line 3, in <module>
from allauth.account.forms import AddEmailForm, BaseSignupForm
File "C:\Users\Freedom\Anaconda3\envs\myvenv\lib\site-packages\allauth\account\forms.py", line 261, in <module>
class BaseSignupForm(_base_signup_form_class()):
File "C:\Users\Freedom\Anaconda3\envs\myvenv\lib\site-packages\allauth\account\forms.py", line 249, in _base_signup_form_class
fc_classname))
django.core.exceptions.ImproperlyConfigured: Module "users.forms" does not define a "SignupForm" class