1👍
✅
password1
and password2
are not fields of the User
. You should remove these:
class CreateUserForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = User
fields = ['username', 'email']
but with this, it makes not much sense to inherit the form anyway.
Furthermore you specify the form class with form_class
[Django-doc], not form
, so:
class CreateUserView(CreateView):
model = User
form_class = CreateUserForm
template_name = 'registration/register.html'
Source:stackexchange.com