21.6.2 Creation Form
Now that we have the ActivationMailFormMixin class, we can build our forms. For the moment, we’ll stick to UserCreationForm.
The reason we are not using Django’s own UserCreationForm is that it only prompts users for a username and a password (twice over), but it does not prompt for their email address. Thankfully, however, we can use the form. Django’s UserCreationForm defines two fields, password1 and password2, and uses ModelForm inheritance to add the username field from the User model.
Ghosts of Django Past
The UserCreationForm prior to Django 1.8 defines the username field explicitly, meaning that our override here (and most of the code in the next chapter) will not work in versions earlier than Django 1.8. Instead, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access