User model is rather unusual, because you’re not supposed to interact with it as you do with other Django models. Specifically, you should never import it directly, as is done in Example 19.10, for reasons we’ll see in Chapter 22.
# this is not the best way to do this! >>> from django.contrib.auth.models import User
Instead, developers should use the
get_user_model() function supplied by auth to get the
User model, as shown in Example 19.11.
# optimal >>> from django.contrib.auth import get_user_model >>> SiteUser = get_user_model() >>> SiteUser <class 'django .contrib.auth.models.User'> >>> User