Django

Code

Changeset 6810

Show
Ignore:
Timestamp:
12/01/07 14:45:05 (1 year ago)
Author:
ubernostrum
Message:

Fixed #3483: Documented AUTH_PROFILE_MODULE and custom user profiles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/authentication.txt

    r6805 r6810  
    155155    * ``get_profile()`` -- Returns a site-specific profile for this user. 
    156156      Raises ``django.contrib.auth.models.SiteProfileNotAvailable`` if the current site 
    157       doesn't allow profiles. 
     157      doesn't allow profiles. For information on how to define a 
     158      site-specific user profile, see the section on `storing additional 
     159      user information`_ below. 
    158160 
    159161.. _Django model: ../model-api/ 
    160162.. _DEFAULT_FROM_EMAIL: ../settings/#default-from-email 
     163.. _storing additional user information: #storing-additional-information-about-users 
    161164 
    162165Manager functions 
     
    269272Make sure to substitute ``/path/to/`` with the path to the Django codebase on 
    270273your filesystem. 
     274 
     275Storing additional information about users 
     276------------------------------------------ 
     277 
     278If you'd like to store additional information related to your users, 
     279Django provides a method to specify a site-specific related model -- 
     280termed a "user profile" -- for this purpose. 
     281 
     282To make use of this feature, define a model with fields for the 
     283additional information you'd like to store, or additional methods 
     284you'd like to have available, and also add a ``ForeignKey`` from your 
     285model to the ``User`` model, specified with ``unique=True`` to ensure 
     286only one instance of your model can be created for each ``User``. 
     287 
     288To indicate that this model is the user profile model for a given 
     289site, fill in the setting ``AUTH_PROFILE_MODULE`` with a string 
     290consisting of the following items, separated by a dot: 
     291 
     2921. The (normalized to lower-case) name of the application in which the 
     293   user profile model is defined (in other words, an all-lowercase 
     294   version of the name which was passed to ``manage.py startapp`` to 
     295   create the application). 
     296 
     2972. The (normalized to lower-case) name of the model class. 
     298 
     299For example, if the profile model was a class named ``UserProfile`` 
     300and was defined inside an application named ``accounts``, the 
     301appropriate setting would be:: 
     302 
     303    AUTH_PROFILE_MODULE = 'accounts.userprofile' 
     304 
     305When a user profile model has been defined and specified in this 
     306manner, each ``User`` object will have a method -- ``get_profile()`` 
     307-- which returns the instance of the user profile model associated 
     308with that ``User``. 
     309 
     310For more information, see `Chapter 12 of the Django book`_. 
     311 
     312.. _Chapter 12 of the Django book: http://www.djangobook.com/en/beta/chapter12/#cn226 
    271313 
    272314Authentication in Web requests 
  • django/trunk/docs/settings.txt

    r6801 r6810  
    236236 
    237237.. _authentication backends documentation: ../authentication/#other-authentication-sources 
     238 
     239AUTH_PROFILE_MODULE 
     240------------------- 
     241 
     242Default: Not defined 
     243 
     244The site-specific user profile model used by this site. See the 
     245`documentation on user profile models`_ for details. 
     246 
     247.. _documentation on user profile models: ../authentication/#storing-additional-information-about-users 
    238248 
    239249CACHE_BACKEND