  
      class Meta:
          app_label = 'auth'
  
  # Undo swap hack
  AbstractUser._meta.local_many_to_many = old_au_local_m2m
  PermissionsMixin._meta.local_many_to_many = old_pm_local_m2m
 
</s> remove     # the is_active attr is provided by AbstractBaseUser


class CustomUserNonUniqueUsername(AbstractBaseUser):
    "A user with a non-unique username"
    username = models.CharField(max_length=30)

    USERNAME_FIELD = 'username'

    class Meta:
        app_label = 'auth'


class CustomUserNonListRequiredFields(AbstractBaseUser):
    "A user with a non-list REQUIRED_FIELDS"
    username = models.CharField(max_length=30, unique=True)
    date_of_birth = models.DateField()

    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = 'date_of_birth'

    class Meta:
        app_label = 'auth'


class CustomUserBadRequiredFields(AbstractBaseUser):
    "A user with a USERNAME_FIELD that appears in REQUIRED_FIELDS (invalid)"
    username = models.CharField(max_length=30, unique=True)
    date_of_birth = models.DateField()

    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = ['username', 'date_of_birth']

    class Meta:
        app_label = 'auth'
 </s> add         REQUIRED_FIELDS = AbstractUser.REQUIRED_FIELDS + ['date_of_birth'] </s> remove class CustomUserWithFK(AbstractBaseUser):
    username = models.ForeignKey(Email, related_name='primary')
    email = models.ForeignKey(Email, to_field='email', related_name='secondary')
    group = models.ForeignKey(Group)

    custom_objects = CustomUserWithFKManager()

    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = ['email', 'group']

    class Meta:
        app_label = 'auth'


# At this point, temporarily remove the groups and user_permissions M2M
# fields from the AbstractUser class, so they don't clash with the related_name
# that sets.
 </s> add class RemoveGroupsAndPermissions(object):
    """
    A context manager to temporarily remove the groups and user_permissions M2M
    fields from the AbstractUser class, so they don't clash with the
    related_name sets.
    """
    def __enter__(self):
        self._old_au_local_m2m = AbstractUser._meta.local_many_to_many
        self._old_pm_local_m2m = PermissionsMixin._meta.local_many_to_many
        groups = models.ManyToManyField(Group, blank=True)
        groups.contribute_to_class(PermissionsMixin, "groups")
        user_permissions = models.ManyToManyField(Permission, blank=True)
        user_permissions.contribute_to_class(PermissionsMixin, "user_permissions")
        PermissionsMixin._meta.local_many_to_many = [groups, user_permissions]
        AbstractUser._meta.local_many_to_many = [groups, user_permissions] </s> remove old_au_local_m2m = AbstractUser._meta.local_many_to_many
old_pm_local_m2m = PermissionsMixin._meta.local_many_to_many
groups = models.ManyToManyField(Group, blank=True)
groups.contribute_to_class(PermissionsMixin, "groups")
user_permissions = models.ManyToManyField(Permission, blank=True)
user_permissions.contribute_to_class(PermissionsMixin, "user_permissions")
PermissionsMixin._meta.local_many_to_many = [groups, user_permissions]
AbstractUser._meta.local_many_to_many = [groups, user_permissions]
 </s> add     def __exit__(self, exc_type, exc_value, traceback):
        AbstractUser._meta.local_many_to_many = self._old_au_local_m2m
        PermissionsMixin._meta.local_many_to_many = self._old_pm_local_m2m </s> remove class ExtensionUser(AbstractUser):
    date_of_birth = models.DateField()

    custom_objects = UserManager()

    REQUIRED_FIELDS = AbstractUser.REQUIRED_FIELDS + ['date_of_birth']

    class Meta:
        app_label = 'auth'


# The CustomPermissionsUser users email as the identifier, but uses the normal
# Django permissions model. This allows us to check that the PermissionsMixin
# includes everything that is needed to interact with the ModelBackend.

class CustomPermissionsUserManager(CustomUserManager):
    def create_superuser(self, email, password, date_of_birth):
        u = self.create_user(email, password=password, date_of_birth=date_of_birth)
        u.is_superuser = True
        u.save(using=self._db)
        return u


class CustomPermissionsUser(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(verbose_name='email address', max_length=255, unique=True)
    date_of_birth = models.DateField()

    custom_objects = CustomPermissionsUserManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['date_of_birth']

    class Meta:
        app_label = 'auth'

    def get_full_name(self):
        return self.email

    def get_short_name(self):
        return self.email

    def __unicode__(self):
        return self.email


class IsActiveTestUser1(AbstractBaseUser):
    """
    This test user class and derivatives test the default is_active behavior
    """
    username = models.CharField(max_length=30, unique=True)

    custom_objects = BaseUserManager()

    USERNAME_FIELD = 'username'

    class Meta:
        app_label = 'auth'
 </s> add         custom_objects = UserManager()
        class Meta:
            app_label = 'auth'
  
      class Meta:
          app_label = 'auth'
  
        class Meta:
            app_label = 'auth'
        class Meta:
            app_label = 'auth'
        class Meta:
            app_label = 'auth'
keep keep keep keep replace replace replace
 Moved non-documented auth test models to the new test location. 
django/contrib/auth/tests/custom_user.py