Extending the user model with django-profiles

Just as django-registration provides a basic set of services for users to create accounts, login, and change passwords, another third-party app provides similar services for profile creation. Django-profiles is also written by James Bennett and is available from the following URL: http://bitbucket.org/ubernostrum/django-profiles/wiki/Home.

The django-profiles app builds off of Django's built-in support for extending the User model using the AUTH_PROFILE_MODULE setting we discussed earlier. It essentially adds a set of generic views, URL patterns, and templates to allow your site to quickly and automatically handle profile creation and changes.

Like django-registration, the profiles app is installed by following the system installation instructions included in the app documentation, then adding 'profiles' to your INSTALLED_APPS setting. You will also need to create a profile model, as we previously discussed, and set AUTH_PROFILE_MODULE appropriately. Once installed, you can add the profile URL patterns to your root URL patterns file like so:

(r'^profiles/', include('profiles.urls')),

As before, you can customize almost all of the profiles application using custom template names, custom forms, and even custom URL patterns.

In the next section we will build a profile class that will extend Django's User model. Using django-profiles is not necessary to proceed to the next section, nor is it required for the rest of this book. In the remaining chapters we will assume that the profile we built in the next section is available on all User objects, whether it was created manually, using django-profiles, or by some other means.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset