mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Moved the AUTH_USER_MODEL setting changed receiver.
Test suites besides Django's may need the same behavior.
This commit is contained in:
parent
b9ae662c97
commit
7694e196ce
2 changed files with 7 additions and 9 deletions
|
@ -3,25 +3,16 @@ from __future__ import unicode_literals
|
|||
|
||||
import warnings
|
||||
|
||||
from django.apps import apps
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import IntegrityError
|
||||
from django.dispatch import receiver
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test.signals import setting_changed
|
||||
from django.utils import translation
|
||||
|
||||
from .models import CustomUser
|
||||
|
||||
|
||||
@receiver(setting_changed)
|
||||
def user_model_swapped(**kwargs):
|
||||
if kwargs['setting'] == 'AUTH_USER_MODEL':
|
||||
apps.clear_cache()
|
||||
|
||||
|
||||
class BasicTestCase(TestCase):
|
||||
def test_user(self):
|
||||
"Check that users can be created and can set their password"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue