mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Cleared get_models cache when swapping User model.
Thanks Florian for isolating the shortest way to reproduce this issue:
./runtests.py \
    django.contrib.auth.tests.test_context_processors.AuthContextProcessorTests.test_perms_attrs \
    django.contrib.auth.tests.test_auth_backends.ChangedBackendSettingsTest.test_changed_backend_settings \
    django.contrib.auth.tests.test_auth_backends.CustomUserModelBackendAuthenticateTest.test_authenticate \
    django.contrib.auth.tests.test_basic.BasicTestCase.test_createsuperuser_management_command
			
			
This commit is contained in:
		| @@ -3,6 +3,7 @@ from __future__ import unicode_literals | ||||
|  | ||||
| import locale | ||||
|  | ||||
| from django.apps import apps | ||||
| from django.contrib.auth import get_user_model | ||||
| from django.contrib.auth.management.commands import createsuperuser | ||||
| from django.contrib.auth.models import User, AnonymousUser | ||||
| @@ -25,6 +26,7 @@ def user_model_swapped(**kwargs): | ||||
|         # Reset User manager | ||||
|         setattr(User, 'objects', User._default_manager) | ||||
|         ensure_default_manager(User) | ||||
|         apps.get_models.cache_clear() | ||||
|  | ||||
|  | ||||
| def mock_inputs(inputs): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user