Fixed #25966 -- Made get_user_model() work at import time.

This makes it equivalent to: `from django.contrib.auth.models import User`.

Thanks Aymeric Augustin for the initial patch and Tim Graham for the
review.
This commit is contained in:
Aymeric Augustin 2016-09-30 22:06:02 +02:00 committed by Markus Holtermann
parent eb42d8d5d9
commit cb7bbf97a7
No known key found for this signature in database
GPG key ID: AFE79D68D41C7E39
10 changed files with 63 additions and 20 deletions

View file

@ -473,10 +473,6 @@ Here are some common problems that you may encounter during initialization:
will also trigger this exception. The ORM cannot function properly until all
models are available.
Another common culprit is :func:`django.contrib.auth.get_user_model()`. Use
the :setting:`AUTH_USER_MODEL` setting to reference the User model at import
time.
This exception also happens if you forget to call :func:`django.setup()` in
a standalone Python script.