Commit 6eb3ce11 authored by Simon Charette's avatar Simon Charette
Browse files

Fixed #26089 -- Removed custom user test models from public API.

Thanks to Tim Graham for the review.
parent 19318507
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -448,6 +448,13 @@ output::
        }
    }

``auth.CustomUser`` and ``auth.ExtensionUser`` test models were removed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since the introduction of migrations for the contrib apps in Django 1.8, the
tables of these custom user test models were not created anymore making them
unusable in a testing context.

Miscellaneous
~~~~~~~~~~~~~

+4 −2
Original line number Diff line number Diff line
from .custom_permissions import CustomPermissionsUser
from .custom_user import CustomUser, ExtensionUser
from .invalid_models import CustomUserNonUniqueUsername
from .is_active import IsActiveTestUser1
from .uuid_pk import UUIDUser
from .with_foreign_key import CustomUserWithFK, Email

__all__ = (
    'CustomPermissionsUser', 'CustomUserWithFK', 'Email',
    'IsActiveTestUser1', 'UUIDUser', 'CustomUserNonUniqueUsername',
    'CustomUser', 'CustomPermissionsUser', 'CustomUserWithFK', 'Email',
    'ExtensionUser', 'IsActiveTestUser1', 'UUIDUser',
    'CustomUserNonUniqueUsername',
)
+2 −3
Original line number Diff line number Diff line
@@ -4,12 +4,11 @@ Django permissions model. This allows us to check that the PermissionsMixin
includes everything that is needed to interact with the ModelBackend.
"""
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.contrib.auth.tests.custom_user import (
    CustomUserManager, RemoveGroupsAndPermissions,
)
from django.db import models
from django.utils.encoding import python_2_unicode_compatible

from .custom_user import CustomUserManager, RemoveGroupsAndPermissions


class CustomPermissionsUserManager(CustomUserManager):
    def create_superuser(self, email, password, date_of_birth):
+0 −6
Original line number Diff line number Diff line
@@ -43,9 +43,6 @@ class CustomUser(AbstractBaseUser):
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['date_of_birth']

    class Meta:
        app_label = 'auth'

    def get_full_name(self):
        return self.email

@@ -108,6 +105,3 @@ with RemoveGroupsAndPermissions():
        custom_objects = UserManager()

        REQUIRED_FIELDS = AbstractUser.REQUIRED_FIELDS + ['date_of_birth']

        class Meta:
            app_label = 'auth'
+2 −1
Original line number Diff line number Diff line
import uuid

from django.contrib.auth.models import AbstractUser
from django.contrib.auth.tests.custom_user import RemoveGroupsAndPermissions
from django.db import models

from .custom_user import RemoveGroupsAndPermissions

with RemoveGroupsAndPermissions():
    class UUIDUser(AbstractUser):
        """A user with a UUID as primary key"""
Loading