Экземпляр пользователя, автоматически созданный после миграции manage.py

После определения пользовательской модели User я создал миграцию перед выполнением python manage.py migrate. При проверке таблицы создается единственный экземпляр User: <User: AnonymousUser>. Почему этот экземпляр вообще должен существовать? Я не знаю ни о каких операциях CREATE, которые выполняются.

(venv) λ python manage.py makemigrations authors --name "created_user_model"
Migrations for 'authors':
  authors\migrations\0001_created_user_model.py
    - Create model User
    - Create model Profile

(venv) λ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, authors, contenttypes, guardian, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying authors.0001_created_user_model... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying guardian.0001_initial... OK
  Applying guardian.0002_generic_permissions_index... OK
  Applying sessions.0001_initial... OK

(venv) λ python manage.py shell
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth import get_user_model
>>> get_user_model().objects.all()
<QuerySet [<User: AnonymousUser>]>

settings.py

AUTH_USER_MODEL = "authors.User"
from django.contrib.auth.models import AbstractUser
from django.conf import settings


class User(AbstractUser):

    username = CharField(
        unique=True, max_length=16,
        error_messages={
            "unique": "Username not available"
        }
    )


class Profile(Model):
    user = OneToOneField(settings.AUTH_USER_MODEL, on_delete=CASCADE)
Вернуться на верх