I'm wondering if I could make UseCreationForm without password confirmation (only password1). Code I'm working with:
#forms.py
class UserRegistrationForm(UserCreationForm):
email = forms.EmailField(max_length=200, help_text='Required')
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')
#views.py
class HomeView(View):
template_name = 'home.html'
def get(self, request):
queryset = Profile.objects.filter(verified=True)
form = UserRegistrationForm()
context = {
'object_list': queryset,
'form':form,
'num_of_users': User.objects.all().count()
}
return render(request, self.template_name, context)
The problem is, that when I make forms.py as that:
class UserRegistrationForm(UserCreationForm):
email = forms.EmailField(max_length=200, help_text='Required')
class Meta:
model = User
fields = ('username', 'email', 'password1')
Form has also field password2. Any solution of that?