mirror of
				https://github.com/django/django.git
				synced 2025-11-03 21:25:09 +00:00 
			
		
		
		
	Deprecate AUTH_PROFILE_MODULE and get_profile().
This commit is contained in:
		
							parent
							
								
									334cdfc1bb
								
							
						
					
					
						commit
						918497218c
					
				
					 5 changed files with 42 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
from __future__ import unicode_literals
 | 
			
		||||
import re
 | 
			
		||||
import urllib
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
from django.core.exceptions import ImproperlyConfigured
 | 
			
		||||
from django.core.mail import send_mail
 | 
			
		||||
| 
						 | 
				
			
			@ -405,6 +405,8 @@ class User(AbstractBaseUser):
 | 
			
		|||
        Returns site-specific profile for this user. Raises
 | 
			
		||||
        SiteProfileNotAvailable if this site does not allow profiles.
 | 
			
		||||
        """
 | 
			
		||||
        warnings.warn("The use of AUTH_PROFILE_MODULE to define user profiles has been deprecated.",
 | 
			
		||||
            PendingDeprecationWarning)
 | 
			
		||||
        if not hasattr(self, '_profile_cache'):
 | 
			
		||||
            from django.conf import settings
 | 
			
		||||
            if not getattr(settings, 'AUTH_PROFILE_MODULE', False):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -286,6 +286,9 @@ these changes.
 | 
			
		|||
* The ``mimetype`` argument to :class:`~django.http.HttpResponse` ``__init__``
 | 
			
		||||
  will be removed (``content_type`` should be used instead).
 | 
			
		||||
 | 
			
		||||
* The ``AUTH_PROFILE_MODULE`` setting, and the ``get_profile()`` method on
 | 
			
		||||
  the User model, will be removed.
 | 
			
		||||
 | 
			
		||||
2.0
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,16 +110,6 @@ A tuple of authentication backend classes (as strings) to use when attempting to
 | 
			
		|||
authenticate a user. See the :doc:`authentication backends documentation
 | 
			
		||||
</ref/authbackends>` for details.
 | 
			
		||||
 | 
			
		||||
.. setting:: AUTH_PROFILE_MODULE
 | 
			
		||||
 | 
			
		||||
AUTH_PROFILE_MODULE
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
Default: Not defined
 | 
			
		||||
 | 
			
		||||
The site-specific user profile model used by this site. See
 | 
			
		||||
:ref:`auth-profiles`.
 | 
			
		||||
 | 
			
		||||
.. setting:: AUTH_USER_MODEL
 | 
			
		||||
 | 
			
		||||
AUTH_USER_MODEL
 | 
			
		||||
| 
						 | 
				
			
			@ -2243,6 +2233,22 @@ ADMIN_MEDIA_PREFIX
 | 
			
		|||
   integration. See the :doc:`Django 1.4 release notes</releases/1.4>` for
 | 
			
		||||
   more information.
 | 
			
		||||
 | 
			
		||||
.. setting:: AUTH_PROFILE_MODULE
 | 
			
		||||
 | 
			
		||||
AUTH_PROFILE_MODULE
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
.. deprecated:: 1.5
 | 
			
		||||
    With the introduction of :ref:`custom User models <auth-custom-user>`,
 | 
			
		||||
    the use of :setting:`AUTH_PROFILE_MODULE` to define a single profile
 | 
			
		||||
    model is no longer supported. See the
 | 
			
		||||
    :doc:`Django 1.5 release notes</releases/1.5>` for more information.
 | 
			
		||||
 | 
			
		||||
Default: Not defined
 | 
			
		||||
 | 
			
		||||
The site-specific user profile model used by this site. See
 | 
			
		||||
:ref:`auth-profiles`.
 | 
			
		||||
 | 
			
		||||
.. setting:: IGNORABLE_404_ENDS
 | 
			
		||||
 | 
			
		||||
IGNORABLE_404_ENDS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -389,3 +389,16 @@ The markup contrib module has been deprecated and will follow an accelerated
 | 
			
		|||
deprecation schedule. Direct use of python markup libraries or 3rd party tag
 | 
			
		||||
libraries is preferred to Django maintaining this functionality in the
 | 
			
		||||
framework.
 | 
			
		||||
 | 
			
		||||
:setting:`AUTH_PROFILE_MODULE`
 | 
			
		||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
 | 
			
		||||
With the introduction of :ref:`custom User models <auth-custom-user>`, there is
 | 
			
		||||
no longer any need for a built-in mechanism to store user profile data.
 | 
			
		||||
 | 
			
		||||
You can still define user profiles models that have a one-to-one relation with
 | 
			
		||||
the User model - in fact, for many applications needing to associate data with
 | 
			
		||||
a User account, this will be an appropriate design pattern to follow. However,
 | 
			
		||||
the :setting:`AUTH_PROFILE_MODULE` setting, and the
 | 
			
		||||
:meth:`~django.contrib.auth.models.User.get_profile()` method for accessing
 | 
			
		||||
the user profile model, should not be used any longer.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -586,6 +586,12 @@ correct path and environment for you.
 | 
			
		|||
Storing additional information about users
 | 
			
		||||
------------------------------------------
 | 
			
		||||
 | 
			
		||||
.. deprecated:: 1.5
 | 
			
		||||
    With the introduction of :ref:`custom User models <auth-custom-user>`,
 | 
			
		||||
    the use of :setting:`AUTH_PROFILE_MODULE` to define a single profile
 | 
			
		||||
    model is no longer supported. See the
 | 
			
		||||
    :doc:`Django 1.5 release notes</releases/1.5>` for more information.
 | 
			
		||||
 | 
			
		||||
If you'd like to store additional information related to your users, Django
 | 
			
		||||
provides a method to specify a site-specific related model -- termed a "user
 | 
			
		||||
profile" -- for this purpose.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue