Loading django/contrib/auth/models.py +0 −32 Original line number Diff line number Diff line Loading @@ -413,38 +413,6 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): """ send_mail(subject, message, from_email, [self.email]) def get_profile(self): """ 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.", DeprecationWarning, stacklevel=2) if not hasattr(self, '_profile_cache'): from django.conf import settings if not getattr(settings, 'AUTH_PROFILE_MODULE', False): raise SiteProfileNotAvailable( 'You need to set AUTH_PROFILE_MODULE in your project ' 'settings') try: app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.') except ValueError: raise SiteProfileNotAvailable( 'app_label and model_name should be separated by a dot in ' 'the AUTH_PROFILE_MODULE setting') try: model = models.get_model(app_label, model_name) if model is None: raise SiteProfileNotAvailable( 'Unable to load the profile model, check ' 'AUTH_PROFILE_MODULE in your project settings') self._profile_cache = model._default_manager.using( self._state.db).get(user__id__exact=self.id) self._profile_cache.user = self except (ImportError, ImproperlyConfigured): raise SiteProfileNotAvailable return self._profile_cache class User(AbstractUser): """ Loading django/contrib/auth/tests/test_models.py +1 −38 Original line number Diff line number Diff line import warnings from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import (Group, User, SiteProfileNotAvailable, UserManager) from django.contrib.auth.models import (Group, User, UserManager) from django.contrib.auth.tests.utils import skipIfCustomUser from django.db.models.signals import post_save from django.test import TestCase from django.test.utils import override_settings from django.utils import six @skipIfCustomUser @override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='') class ProfileTestCase(TestCase): def test_site_profile_not_available(self): user = User.objects.create(username='testclient') # calling get_profile without AUTH_PROFILE_MODULE set del settings.AUTH_PROFILE_MODULE with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "You need to set AUTH_PROFILE_MODULE in your project"): user.get_profile() # Bad syntax in AUTH_PROFILE_MODULE: settings.AUTH_PROFILE_MODULE = 'foobar' with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "app_label and model_name should be separated by a dot"): user.get_profile() # module that doesn't exist settings.AUTH_PROFILE_MODULE = 'foo.bar' with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "Unable to load the profile model"): user.get_profile() @skipIfCustomUser Loading docs/ref/contrib/auth.txt +0 −14 Original line number Diff line number Diff line Loading @@ -218,20 +218,6 @@ Methods Sends an email to the user. If ``from_email`` is ``None``, Django uses the :setting:`DEFAULT_FROM_EMAIL`. .. method:: get_profile() .. 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. Returns a site-specific profile for this user. Raises ``django.contrib.auth.models.SiteProfileNotAvailable`` if the current site doesn't allow profiles, or :exc:`django.core.exceptions.ObjectDoesNotExist` if the user does not have a profile. Manager methods --------------- Loading docs/ref/settings.txt +0 −16 Original line number Diff line number Diff line Loading @@ -2049,22 +2049,6 @@ A tuple of authentication backend classes (as strings) to use when attempting to authenticate a user. See the :ref:`authentication backends documentation <authentication-backends>` for details. .. 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:`User profiles <auth-profiles>`. .. setting:: AUTH_USER_MODEL AUTH_USER_MODEL Loading docs/releases/1.5-alpha-1.txt +4 −4 Original line number Diff line number Diff line Loading @@ -575,8 +575,8 @@ Miscellaneous Features deprecated in 1.5 ========================== :setting:`AUTH_PROFILE_MODULE` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``AUTH_PROFILE_MODULE`` setting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. Loading @@ -584,8 +584,8 @@ 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 ``AUTH_PROFILE_MODULE`` setting, and the ``django.contrib.auth.models.User.get_profile()`` method for accessing the user profile model, should not be used any longer. Streaming behavior of :class:`~django.http.HttpResponse` Loading Loading
django/contrib/auth/models.py +0 −32 Original line number Diff line number Diff line Loading @@ -413,38 +413,6 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): """ send_mail(subject, message, from_email, [self.email]) def get_profile(self): """ 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.", DeprecationWarning, stacklevel=2) if not hasattr(self, '_profile_cache'): from django.conf import settings if not getattr(settings, 'AUTH_PROFILE_MODULE', False): raise SiteProfileNotAvailable( 'You need to set AUTH_PROFILE_MODULE in your project ' 'settings') try: app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.') except ValueError: raise SiteProfileNotAvailable( 'app_label and model_name should be separated by a dot in ' 'the AUTH_PROFILE_MODULE setting') try: model = models.get_model(app_label, model_name) if model is None: raise SiteProfileNotAvailable( 'Unable to load the profile model, check ' 'AUTH_PROFILE_MODULE in your project settings') self._profile_cache = model._default_manager.using( self._state.db).get(user__id__exact=self.id) self._profile_cache.user = self except (ImportError, ImproperlyConfigured): raise SiteProfileNotAvailable return self._profile_cache class User(AbstractUser): """ Loading
django/contrib/auth/tests/test_models.py +1 −38 Original line number Diff line number Diff line import warnings from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import (Group, User, SiteProfileNotAvailable, UserManager) from django.contrib.auth.models import (Group, User, UserManager) from django.contrib.auth.tests.utils import skipIfCustomUser from django.db.models.signals import post_save from django.test import TestCase from django.test.utils import override_settings from django.utils import six @skipIfCustomUser @override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='') class ProfileTestCase(TestCase): def test_site_profile_not_available(self): user = User.objects.create(username='testclient') # calling get_profile without AUTH_PROFILE_MODULE set del settings.AUTH_PROFILE_MODULE with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "You need to set AUTH_PROFILE_MODULE in your project"): user.get_profile() # Bad syntax in AUTH_PROFILE_MODULE: settings.AUTH_PROFILE_MODULE = 'foobar' with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "app_label and model_name should be separated by a dot"): user.get_profile() # module that doesn't exist settings.AUTH_PROFILE_MODULE = 'foo.bar' with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) with six.assertRaisesRegex(self, SiteProfileNotAvailable, "Unable to load the profile model"): user.get_profile() @skipIfCustomUser Loading
docs/ref/contrib/auth.txt +0 −14 Original line number Diff line number Diff line Loading @@ -218,20 +218,6 @@ Methods Sends an email to the user. If ``from_email`` is ``None``, Django uses the :setting:`DEFAULT_FROM_EMAIL`. .. method:: get_profile() .. 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. Returns a site-specific profile for this user. Raises ``django.contrib.auth.models.SiteProfileNotAvailable`` if the current site doesn't allow profiles, or :exc:`django.core.exceptions.ObjectDoesNotExist` if the user does not have a profile. Manager methods --------------- Loading
docs/ref/settings.txt +0 −16 Original line number Diff line number Diff line Loading @@ -2049,22 +2049,6 @@ A tuple of authentication backend classes (as strings) to use when attempting to authenticate a user. See the :ref:`authentication backends documentation <authentication-backends>` for details. .. 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:`User profiles <auth-profiles>`. .. setting:: AUTH_USER_MODEL AUTH_USER_MODEL Loading
docs/releases/1.5-alpha-1.txt +4 −4 Original line number Diff line number Diff line Loading @@ -575,8 +575,8 @@ Miscellaneous Features deprecated in 1.5 ========================== :setting:`AUTH_PROFILE_MODULE` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``AUTH_PROFILE_MODULE`` setting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. Loading @@ -584,8 +584,8 @@ 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 ``AUTH_PROFILE_MODULE`` setting, and the ``django.contrib.auth.models.User.get_profile()`` method for accessing the user profile model, should not be used any longer. Streaming behavior of :class:`~django.http.HttpResponse` Loading