21.6.3 Views for Creating and Activating Accounts

Now that we have our UserCreationForm, we can build the views to create and activate new users. To begin, we can create the CreateAccount view, starting in the user/urls.py file. We first import the necessary tools and views, as shown in Example 21.59.

Example 21.59: Project Code

user/urls.py in 9af8a05373

 7   from django.views.generic import (  8       RedirectView, TemplateView)  9 10   from .views import ( 11       ActivateAccount, CreateAccount, 12       DisableAccount)

We can then create a very simple URL pattern for CreateAccount, as shown in Example 21.60.

Example 21.60: Project Code

user/urls.py in 9af8a05373

73     url(

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.