Setting up the application

Required templates

To use the views in django-change-email several templates need to be provided.

Note

Because django-change-email is intended to be highly reusable it does not include any other templates than the ones used for testing the application. It is left to programmers using django-change-email to create templates for projects as needed.

The naming of these templates follows the convention used by class based views in Dango:

It is possible to use different templates. Informations on how to change the templates locations can be found in the settings documentation.

Additional templates are required to send confirmation mails on email address change requests. Information on these templates can also be found in the settings documentation.

Note

Minimal example e-mail templates can be found inside the tests module of django-change-email.

Setting up URLs

django-change-email includes a Django URLconf which sets up URL patterns for the views in django-change-email. This URLconf can be found at change_email.urls, and so can simply be included in a project’s root URL configuration. For example, to place the URLs under the prefix /account/, one could add the following to a project’s root URLconf:

(r'^account/', include('change_email.urls')),

Users would then be able to change their email address or check pending change requests by visiting the URL /account/email/change/.

Adding the app to the installed applications

To use django-change-email in a Django project add change_email to the INSTALLED_APPS setting of a project.

For example, one might have something like the following in a Django settings file:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.messages',
    'change_email',
    # ...other installed applications...
)

Creating the database tables

To create the database tables needed by django-change-email simply run the following inside a project’s root directory:

$ python manage.py syncdb