From b23b1e61980df5bdc0d2fa0dce95398b7c85bbd4 Mon Sep 17 00:00:00 2001 From: Ivan Filippov Date: Mon, 18 Dec 2023 10:34:21 +0500 Subject: [PATCH 1/5] Refactoring User_Model --- Makefile | 7 +- .../adaptive_hockey_federation/constants.py | 12 ++ adaptive_hockey_federation/users/admin.py | 12 +- adaptive_hockey_federation/users/managers.py | 36 ++++++ ...er_options_alter_user_managers_and_more.py | 62 +++++++++ adaptive_hockey_federation/users/models.py | 120 ++++++++++++------ 6 files changed, 201 insertions(+), 48 deletions(-) create mode 100644 adaptive_hockey_federation/adaptive_hockey_federation/constants.py create mode 100644 adaptive_hockey_federation/users/managers.py create mode 100644 adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py diff --git a/Makefile b/Makefile index 7a7cf967..b6db0333 100644 --- a/Makefile +++ b/Makefile @@ -57,8 +57,13 @@ run: cd $(PROJECT_DIR) && $(DJANGO_RUN) runserver +# Запуск django shell +shell: + cd $(PROJECT_DIR) && $(DJANGO_RUN) shell + + # Заполнение базы данных с помощью парсера. fill-db: cd $(PROJECT_DIR) && $(DJANGO_RUN) fill-db -.PHONY: help +.PHONY: help \ No newline at end of file diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/constants.py b/adaptive_hockey_federation/adaptive_hockey_federation/constants.py new file mode 100644 index 00000000..03dd0722 --- /dev/null +++ b/adaptive_hockey_federation/adaptive_hockey_federation/constants.py @@ -0,0 +1,12 @@ +NAME_MAX_LENGTH = 256 +EMAIL_MAX_LENGTH = 256 +QUERY_SET_LENGTH = 15 + +ROLE_AGENT = 'agent' +ROLE_MODERATOR = 'moderator' +ROLE_ADMIN = 'admin' +ROLES_CHOICES = ( + (ROLE_AGENT, 'Представитель команды'), + (ROLE_MODERATOR, 'Модератор'), + (ROLE_ADMIN, 'Администратор'), +) diff --git a/adaptive_hockey_federation/users/admin.py b/adaptive_hockey_federation/users/admin.py index 93fb3d3e..23f2e93c 100644 --- a/adaptive_hockey_federation/users/admin.py +++ b/adaptive_hockey_federation/users/admin.py @@ -7,20 +7,16 @@ class UserAdmin(admin.ModelAdmin): # date_hierarchy = 'date_joined' list_display = ( 'id', - 'username', - 'email', - 'phone', 'first_name', 'last_name', 'role', - 'team', - ) - fields = [ - 'username', 'email', 'phone', + ) + fields = [ ('first_name', 'last_name'), 'role', - 'team', + 'email', + 'phone', ] empty_value_display = '-пусто-' diff --git a/adaptive_hockey_federation/users/managers.py b/adaptive_hockey_federation/users/managers.py new file mode 100644 index 00000000..bb4de6cc --- /dev/null +++ b/adaptive_hockey_federation/users/managers.py @@ -0,0 +1,36 @@ +from django.contrib.auth.base_user import BaseUserManager +from django.utils.translation import gettext_lazy as _ + + +class CustomUserManager(BaseUserManager): + """ + Кастомный менеджер модели пользователя, + где идентификатором является поле с адресом электронной почты. + """ + + use_in_migrations = True + + def _create_user(self, email, password, **extra_fields): + if not email: + raise ValueError(_('Предоставить адрес электронной почты.')) + email = self.normalize_email(email) + user = self.model(email=email, **extra_fields) + user.set_password(password) + user.save() + return user + + def create_user(self, email, password=None, **extra_fields): + extra_fields.setdefault('is_staff', False) + extra_fields.setdefault('is_superuser', False) + return self._create_user(email, password, **extra_fields) + + def create_superuser(self, email, password, **extra_fields): + extra_fields.setdefault('is_staff', True) + extra_fields.setdefault('is_superuser', True) + extra_fields['role'] = 'admin' + if extra_fields.get('is_staff') is not True: + raise ValueError(_('Суперюзер должен иметь is_staff=True.')) + if extra_fields.get('is_superuser') is not True: + raise ValueError(_('Суперюзер должен иметь is_superuser=True.')) + + return self._create_user(email, password, **extra_fields) diff --git a/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py b/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py new file mode 100644 index 00000000..393297ea --- /dev/null +++ b/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py @@ -0,0 +1,62 @@ +# Generated by Django 4.2.7 on 2023-12-18 05:27 + +from django.db import migrations, models +import users.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0003_alter_user_first_name_alter_user_last_name'), + ] + + operations = [ + migrations.AlterModelOptions( + name='user', + options={'ordering': ('last_name',), 'verbose_name': 'Пользователь', 'verbose_name_plural': 'Пользователи'}, + ), + migrations.AlterModelManagers( + name='user', + managers=[ + ('objects', users.managers.CustomUserManager()), + ], + ), + migrations.RemoveField( + model_name='user', + name='team', + ), + migrations.RemoveField( + model_name='user', + name='username', + ), + migrations.AddField( + model_name='user', + name='patronymic', + field=models.CharField(blank=True, help_text='Отчество', max_length=256, verbose_name='Отчество'), + ), + migrations.AlterField( + model_name='user', + name='email', + field=models.EmailField(help_text='Электронная почта', max_length=256, unique=True, verbose_name='Электронная почта'), + ), + migrations.AlterField( + model_name='user', + name='first_name', + field=models.CharField(help_text='Имя', max_length=256, verbose_name='Имя'), + ), + migrations.AlterField( + model_name='user', + name='last_name', + field=models.CharField(help_text='Фамилия', max_length=256, verbose_name='Фамилия'), + ), + migrations.AlterField( + model_name='user', + name='phone', + field=models.CharField(max_length=12), + ), + migrations.AlterField( + model_name='user', + name='role', + field=models.CharField(choices=[('agent', 'Представитель команды'), ('moderator', 'Модератор'), ('admin', 'Администратор')], default='agent', help_text='Уровень прав доступа', max_length=9, verbose_name='Роль'), + ), + ] diff --git a/adaptive_hockey_federation/users/models.py b/adaptive_hockey_federation/users/models.py index cf081d90..26ce19e8 100644 --- a/adaptive_hockey_federation/users/models.py +++ b/adaptive_hockey_federation/users/models.py @@ -1,67 +1,109 @@ from django.contrib.auth.models import AbstractUser from django.db import models -from django.db.models import SET_NULL, CharField, ForeignKey -from main.models import Team - -NAME_MAX_LENGTH = 256 -EMAIL_MAX_LENGTH = 256 -PHONE_MAX_LENGTH = 20 - -ROLE_USER = 'user' -ROLE_AGENT = 'agent' -ROLE_MODERATOR = 'moderator' -ROLE_ADMIN = 'admin' - -ROLES_CHOICES = ( - (ROLE_USER, 'Пользователь'), - (ROLE_AGENT, 'Представитель команды'), - (ROLE_MODERATOR, 'Модератор'), - (ROLE_ADMIN, 'Администратор'), +from django.utils.translation import gettext_lazy as _ + +from adaptive_hockey_federation.constants import ( + EMAIL_MAX_LENGTH, + NAME_MAX_LENGTH, + QUERY_SET_LENGTH, + ROLE_ADMIN, + ROLE_AGENT, + ROLE_MODERATOR, + ROLES_CHOICES, ) +from .managers import CustomUserManager + class User(AbstractUser): - phone: models.CharField = CharField( - max_length=PHONE_MAX_LENGTH, - ) - role: models.CharField = CharField( - choices=ROLES_CHOICES, - default=ROLE_USER, - max_length=max(len(role) for role, _ in ROLES_CHOICES) - ) - first_name: models.CharField = CharField( + """ + Кастомная модель пользователя, поле 'username' исключено, + идентификатором является поле с адресом электронной почты. + """ + + username = None + first_name = models.CharField( max_length=NAME_MAX_LENGTH, - default='', + verbose_name=_('Имя'), + help_text=_('Имя'), ) - last_name: models.CharField = CharField( + last_name = models.CharField( max_length=NAME_MAX_LENGTH, - default='', + verbose_name=_('Фамилия'), + help_text=_('Фамилия'), ) - team: models.ForeignKey = ForeignKey( - to=Team, - on_delete=SET_NULL, - related_name='users', - verbose_name='Команда', + patronymic = models.CharField( blank=True, - null=True, + max_length=NAME_MAX_LENGTH, + verbose_name=_('Отчество'), + help_text=_('Отчество'), + ) + role = models.CharField( + choices=ROLES_CHOICES, + default=ROLE_AGENT, + max_length=max(len(role) for role, _ in ROLES_CHOICES), + verbose_name=_('Роль'), + help_text=_('Уровень прав доступа'), + ) + email = models.EmailField( + max_length=EMAIL_MAX_LENGTH, + unique=True, + verbose_name=_('Электронная почта'), + help_text=_('Электронная почта'), + ) + phone = models.CharField( + max_length=12, + ) + + USERNAME_FIELD = 'email' + REQUIRED_FIELDS = ('first_name', 'last_name', 'role',) + + objects = CustomUserManager() class Meta: - verbose_name = 'Пользователь' - verbose_name_plural = 'Пользователи' - ordering = ('username',) + verbose_name = _('Пользователь') + verbose_name_plural = _('Пользователи') + ordering = ('last_name',) def __str__(self): - return self.username + return self.email[:QUERY_SET_LENGTH].capitalize() + + def get_username(self): + return ( + f'{self.first_name[:QUERY_SET_LENGTH]} ' + f'{self.last_name[:QUERY_SET_LENGTH]}' + ) + + def get_full_name(self): + return ( + f'{self.first_name[:QUERY_SET_LENGTH]} ' + f'{self.patronymic[:QUERY_SET_LENGTH]} ' + f'{self.last_name[:QUERY_SET_LENGTH]}' + + ) @property def is_agent(self): + """ + Представитель команды - имеет возможность редактировать данные детей в + своей команде. Просматривать некоторые данные по игрокам в других + командах (ФИО, возраст, спортивный класс, тип заболевания). + Выгружать формы по своей команде. Загружать сканы справок. + """ return self.role == ROLE_AGENT @property def is_moderator(self): + """ + Модератор - имеет возможности вносить данные по определенному ребенку, + не может добавлять новых пользователей и удалять детей, команды. + """ return self.role == ROLE_MODERATOR @property def is_admin(self): + """ + Администратор - имеет неограниченные права управления на проекте. + """ return (self.role == ROLE_ADMIN) or self.is_staff From 5e937b0c3bafeb705ca20f1aef7b673497a77108 Mon Sep 17 00:00:00 2001 From: Ivan Filippov Date: Mon, 18 Dec 2023 11:09:24 +0500 Subject: [PATCH 2/5] Add django-phonenumber-field --- .../adaptive_hockey_federation/settings.py | 4 +++ .../users/migrations/0005_alter_user_phone.py | 20 +++++++++++ adaptive_hockey_federation/users/models.py | 10 ++++-- poetry.lock | 34 +++++++++++++++++-- pyproject.toml | 1 + 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py index 8a697397..e1e7917f 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py +++ b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py @@ -19,6 +19,7 @@ 'main.apps.MainConfig', 'users.apps.UsersConfig', 'core.apps.CoreConfig', + 'phonenumber_field', ] MIDDLEWARE = [ @@ -74,6 +75,9 @@ }, ] +PHONENUMBER_DEFAULT_REGION = 'RU' +PHONENUMBER_DEFAULT_FORMAT = 'INTERNATIONAL' + LANGUAGE_CODE = 'ru' TIME_ZONE = 'Europe/Moscow' diff --git a/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py b/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py new file mode 100644 index 00000000..7689c1cd --- /dev/null +++ b/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.7 on 2023-12-18 05:57 + +from django.db import migrations +import phonenumber_field.modelfields +import phonenumber_field.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0004_alter_user_options_alter_user_managers_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='phone', + field=phonenumber_field.modelfields.PhoneNumberField(blank=True, help_text='Номер телефона, допустимый формат - +7 ХХХ ХХХ ХХ ХХ', max_length=128, region=None, validators=[phonenumber_field.validators.validate_international_phonenumber], verbose_name='Актуальный номер телефона'), + ), + ] diff --git a/adaptive_hockey_federation/users/models.py b/adaptive_hockey_federation/users/models.py index 26ce19e8..826d41b8 100644 --- a/adaptive_hockey_federation/users/models.py +++ b/adaptive_hockey_federation/users/models.py @@ -1,6 +1,8 @@ from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.translation import gettext_lazy as _ +from phonenumber_field.modelfields import PhoneNumberField +from phonenumber_field.validators import validate_international_phonenumber from adaptive_hockey_federation.constants import ( EMAIL_MAX_LENGTH, @@ -52,8 +54,11 @@ class User(AbstractUser): verbose_name=_('Электронная почта'), help_text=_('Электронная почта'), ) - phone = models.CharField( - max_length=12, + phone = PhoneNumberField( + blank=True, + validators=[validate_international_phonenumber], + verbose_name=_('Актуальный номер телефона'), + help_text=_('Номер телефона, допустимый формат - +7 ХХХ ХХХ ХХ ХХ'), ) USERNAME_FIELD = 'email' @@ -80,7 +85,6 @@ def get_full_name(self): f'{self.first_name[:QUERY_SET_LENGTH]} ' f'{self.patronymic[:QUERY_SET_LENGTH]} ' f'{self.last_name[:QUERY_SET_LENGTH]}' - ) @property diff --git a/poetry.lock b/poetry.lock index be4225dc..7b3c293b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "asgiref" @@ -206,6 +206,25 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "django-phonenumber-field" +version = "7.2.0" +description = "An international phone number field for django models." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-phonenumber-field-7.2.0.tar.gz", hash = "sha256:20c7c5c449e33eed5fd45ef8d3dc668faabaeff3277eddd1892b262d686ba381"}, + {file = "django_phonenumber_field-7.2.0-py3-none-any.whl", hash = "sha256:16778f2717ea2aecc6178beb0d6bc431c78c6a8b0474e1fa8face040efeb6e9e"}, +] + +[package.dependencies] +Django = ">=3.2" +phonenumbers = {version = ">=7.0.2", optional = true, markers = "extra == \"phonenumbers\""} + +[package.extras] +phonenumbers = ["phonenumbers (>=7.0.2)"] +phonenumberslite = ["phonenumberslite (>=7.0.2)"] + [[package]] name = "django-stubs" version = "4.2.4" @@ -653,6 +672,17 @@ files = [ {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, ] +[[package]] +name = "phonenumbers" +version = "8.13.26" +description = "Python version of Google's common library for parsing, formatting, storing and validating international phone numbers." +optional = false +python-versions = "*" +files = [ + {file = "phonenumbers-8.13.26-py2.py3-none-any.whl", hash = "sha256:b2308c9c5750b8f10dd30d94547afd66bce60ac5e93aff227f95740557f32752"}, + {file = "phonenumbers-8.13.26.tar.gz", hash = "sha256:937d70aeceb317f5831dfec28de855a60260ef4a9d551964bec8e7a7d0cf81cd"}, +] + [[package]] name = "platformdirs" version = "4.1.0" @@ -1009,4 +1039,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "f237815c587070334308524ad0eb91285d7290f76e985ecd665a53da2d654b21" +content-hash = "49ddfd3afd505218316754042963b5ad0bd71439e171505e1cc8dc7de17a2852" diff --git a/pyproject.toml b/pyproject.toml index 2de650c5..68eb418a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ types-openpyxl = "^3.1.0.24" openpyxl-stubs = "^0.1.25" click = "^8.1.7" wrapt = "^1.16.0" +django-phonenumber-field = {extras = ["phonenumbers"], version = "^7.2.0"} [tool.poetry.group.dev.dependencies] isort = "^5.12.0" From d5015ca1cd4e507caaa073401fa360c60910092c Mon Sep 17 00:00:00 2001 From: Ivan Filippov Date: Mon, 18 Dec 2023 21:45:12 +0500 Subject: [PATCH 3/5] bugfix of mypy/added django-extensions 3.2.3 --- Makefile | 4 +- .../adaptive_hockey_federation/settings.py | 1 + ...er_options_alter_user_managers_and_more.py | 24 +- .../users/migrations/0005_alter_user_phone.py | 20 -- adaptive_hockey_federation/users/models.py | 33 ++- poetry.lock | 230 +++++++++--------- pyproject.toml | 2 + requirements/develop.txt | 15 +- requirements/production.txt | 10 +- 9 files changed, 189 insertions(+), 150 deletions(-) delete mode 100644 adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py diff --git a/Makefile b/Makefile index b6db0333..f4028210 100644 --- a/Makefile +++ b/Makefile @@ -59,11 +59,11 @@ run: # Запуск django shell shell: - cd $(PROJECT_DIR) && $(DJANGO_RUN) shell + cd $(PROJECT_DIR) && $(DJANGO_RUN) shell_plus --plain # Заполнение базы данных с помощью парсера. fill-db: cd $(PROJECT_DIR) && $(DJANGO_RUN) fill-db -.PHONY: help \ No newline at end of file +.PHONY: help diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py index dd49ddb3..3b015541 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py +++ b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py @@ -24,6 +24,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django_extensions', 'main.apps.MainConfig', 'users.apps.UsersConfig', 'core.apps.CoreConfig', diff --git a/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py b/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py index 393297ea..469a7d16 100644 --- a/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py +++ b/adaptive_hockey_federation/users/migrations/0004_alter_user_options_alter_user_managers_and_more.py @@ -1,7 +1,10 @@ -# Generated by Django 4.2.7 on 2023-12-18 05:27 +# Generated by Django 4.2.8 on 2023-12-18 15:37 -from django.db import migrations, models +import django.utils.timezone +import phonenumber_field.modelfields +import phonenumber_field.validators import users.managers +from django.db import migrations, models class Migration(migrations.Migration): @@ -34,6 +37,11 @@ class Migration(migrations.Migration): name='patronymic', field=models.CharField(blank=True, help_text='Отчество', max_length=256, verbose_name='Отчество'), ), + migrations.AlterField( + model_name='user', + name='date_joined', + field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Дата регистрации.'), + ), migrations.AlterField( model_name='user', name='email', @@ -44,6 +52,16 @@ class Migration(migrations.Migration): name='first_name', field=models.CharField(help_text='Имя', max_length=256, verbose_name='Имя'), ), + migrations.AlterField( + model_name='user', + name='is_active', + field=models.BooleanField(default=True, verbose_name='Показывает статус он-лайн.'), + ), + migrations.AlterField( + model_name='user', + name='is_staff', + field=models.BooleanField(default=False, verbose_name='Статус администратора.'), + ), migrations.AlterField( model_name='user', name='last_name', @@ -52,7 +70,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='user', name='phone', - field=models.CharField(max_length=12), + field=phonenumber_field.modelfields.PhoneNumberField(blank=True, help_text='Номер телефона, допустимый формат - +7 ХХХ ХХХ ХХ ХХ', max_length=128, region=None, validators=[phonenumber_field.validators.validate_international_phonenumber], verbose_name='Актуальный номер телефона'), ), migrations.AlterField( model_name='user', diff --git a/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py b/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py deleted file mode 100644 index 7689c1cd..00000000 --- a/adaptive_hockey_federation/users/migrations/0005_alter_user_phone.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.2.7 on 2023-12-18 05:57 - -from django.db import migrations -import phonenumber_field.modelfields -import phonenumber_field.validators - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0004_alter_user_options_alter_user_managers_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='phone', - field=phonenumber_field.modelfields.PhoneNumberField(blank=True, help_text='Номер телефона, допустимый формат - +7 ХХХ ХХХ ХХ ХХ', max_length=128, region=None, validators=[phonenumber_field.validators.validate_international_phonenumber], verbose_name='Актуальный номер телефона'), - ), - ] diff --git a/adaptive_hockey_federation/users/models.py b/adaptive_hockey_federation/users/models.py index 826d41b8..48182771 100644 --- a/adaptive_hockey_federation/users/models.py +++ b/adaptive_hockey_federation/users/models.py @@ -1,5 +1,7 @@ -from django.contrib.auth.models import AbstractUser +from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin +from django.core.mail import send_mail from django.db import models +from django.utils import timezone from django.utils.translation import gettext_lazy as _ from phonenumber_field.modelfields import PhoneNumberField from phonenumber_field.validators import validate_international_phonenumber @@ -17,13 +19,12 @@ from .managers import CustomUserManager -class User(AbstractUser): +class User(AbstractBaseUser, PermissionsMixin): """ Кастомная модель пользователя, поле 'username' исключено, идентификатором является поле с адресом электронной почты. """ - username = None first_name = models.CharField( max_length=NAME_MAX_LENGTH, verbose_name=_('Имя'), @@ -60,17 +61,34 @@ class User(AbstractUser): verbose_name=_('Актуальный номер телефона'), help_text=_('Номер телефона, допустимый формат - +7 ХХХ ХХХ ХХ ХХ'), ) - - USERNAME_FIELD = 'email' - REQUIRED_FIELDS = ('first_name', 'last_name', 'role',) + date_joined = models.DateTimeField( + default=timezone.now, + verbose_name=_('Дата регистрации.'), + ) + is_staff = models.BooleanField( + default=False, + verbose_name=_('Статус администратора.'), + ) + is_active = models.BooleanField( + default=True, + verbose_name=_('Показывает статус он-лайн.'), + ) objects = CustomUserManager() + EMAIL_FIELD = "email" + USERNAME_FIELD = 'email' + REQUIRED_FIELDS = ['first_name', 'last_name', 'role'] + class Meta: verbose_name = _('Пользователь') verbose_name_plural = _('Пользователи') ordering = ('last_name',) + def clean(self): + super().clean() + self.email = self.__class__.objects.normalize_email(self.email) + def __str__(self): return self.email[:QUERY_SET_LENGTH].capitalize() @@ -87,6 +105,9 @@ def get_full_name(self): f'{self.last_name[:QUERY_SET_LENGTH]}' ) + def email_user(self, subject, message, from_email=None, **kwargs): + send_mail(subject, message, from_email, [self.email], **kwargs) + @property def is_agent(self): """ diff --git a/poetry.lock b/poetry.lock index 7b3c293b..f6c8ef05 100644 --- a/poetry.lock +++ b/poetry.lock @@ -31,13 +31,13 @@ wrapt = {version = ">=1.14,<2", markers = "python_version >= \"3.11\""} [[package]] name = "certifi" -version = "2023.7.22" +version = "2023.11.17" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, - {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, + {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, + {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, ] [[package]] @@ -177,24 +177,24 @@ files = [ [[package]] name = "distlib" -version = "0.3.7" +version = "0.3.8" description = "Distribution utilities" optional = false python-versions = "*" files = [ - {file = "distlib-0.3.7-py2.py3-none-any.whl", hash = "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057"}, - {file = "distlib-0.3.7.tar.gz", hash = "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8"}, + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] [[package]] name = "django" -version = "4.2.7" +version = "4.2.8" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.2.7-py3-none-any.whl", hash = "sha256:e1d37c51ad26186de355cbcec16613ebdabfa9689bbade9c538835205a8abbe9"}, - {file = "Django-4.2.7.tar.gz", hash = "sha256:8e0f1c2c2786b5c0e39fe1afce24c926040fad47c8ea8ad30aaf1188df29fc41"}, + {file = "Django-4.2.8-py3-none-any.whl", hash = "sha256:6cb5dcea9e3d12c47834d32156b8841f533a4493c688e2718cafd51aa430ba6d"}, + {file = "Django-4.2.8.tar.gz", hash = "sha256:d69d5e36cc5d9f4eb4872be36c622878afcdce94062716cf3e25bcedcb168b62"}, ] [package.dependencies] @@ -206,6 +206,20 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "django-extensions" +version = "3.2.3" +description = "Extensions for Django" +optional = false +python-versions = ">=3.6" +files = [ + {file = "django-extensions-3.2.3.tar.gz", hash = "sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a"}, + {file = "django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401"}, +] + +[package.dependencies] +Django = ">=3.2" + [[package]] name = "django-phonenumber-field" version = "7.2.0" @@ -227,35 +241,34 @@ phonenumberslite = ["phonenumberslite (>=7.0.2)"] [[package]] name = "django-stubs" -version = "4.2.4" +version = "4.2.7" description = "Mypy stubs for Django" optional = false python-versions = ">=3.8" files = [ - {file = "django-stubs-4.2.4.tar.gz", hash = "sha256:7d4a132c381519815e865c27a89eca41bcbd06056832507224816a43d75c601c"}, - {file = "django_stubs-4.2.4-py3-none-any.whl", hash = "sha256:834b60fd81510cce6b56c1c6c28bec3c504a418bc90ff7d0063fabe8ab9a7868"}, + {file = "django-stubs-4.2.7.tar.gz", hash = "sha256:8ccd2ff4ee5adf22b9e3b7b1a516d2e1c2191e9d94e672c35cc2bc3dd61e0f6b"}, + {file = "django_stubs-4.2.7-py3-none-any.whl", hash = "sha256:4cf4de258fa71adc6f2799e983091b9d46cfc67c6eebc68fe111218c9a62b3b8"}, ] [package.dependencies] django = "*" -django-stubs-ext = ">=4.2.2" -mypy = ">=1.0.0" +django-stubs-ext = ">=4.2.7" types-pytz = "*" types-PyYAML = "*" typing-extensions = "*" [package.extras] -compatible-mypy = ["mypy (==1.5.*)"] +compatible-mypy = ["mypy (>=1.7.0,<1.8.0)"] [[package]] name = "django-stubs-ext" -version = "4.2.2" +version = "4.2.7" description = "Monkey-patching and extensions for django-stubs" optional = false python-versions = ">=3.8" files = [ - {file = "django-stubs-ext-4.2.2.tar.gz", hash = "sha256:c69d1cc46f1c4c3b7894b685a5022c29b2a36c7cfb52e23762eaf357ebfc2c98"}, - {file = "django_stubs_ext-4.2.2-py3-none-any.whl", hash = "sha256:fdacc65a14d2d4b97334b58ff178a5853ec8c8c76cec406e417916ad67536ce4"}, + {file = "django-stubs-ext-4.2.7.tar.gz", hash = "sha256:519342ac0849cda1559746c9a563f03ff99f636b0ebe7c14b75e816a00dfddc3"}, + {file = "django_stubs_ext-4.2.7-py3-none-any.whl", hash = "sha256:45a5d102417a412e3606e3c358adb4744988a92b7b58ccf3fd64bddd5d04d14c"}, ] [package.dependencies] @@ -321,12 +334,13 @@ flake8 = ">=3.8.4,<7" [[package]] name = "flake8-isort" -version = "6.1.0" -description = "flake8 plugin that integrates isort ." +version = "6.1.1" +description = "flake8 plugin that integrates isort" optional = false python-versions = ">=3.8" files = [ - {file = "flake8-isort-6.1.0.tar.gz", hash = "sha256:d4639343bac540194c59fb1618ac2c285b3e27609f353bef6f50904d40c1643e"}, + {file = "flake8_isort-6.1.1-py3-none-any.whl", hash = "sha256:0fec4dc3a15aefbdbe4012e51d5531a2eb5fa8b981cdfbc882296a59b54ede12"}, + {file = "flake8_isort-6.1.1.tar.gz", hash = "sha256:c1f82f3cf06a80c13e1d09bfae460e9666255d5c780b859f19f8318d420370b3"}, ] [package.dependencies] @@ -372,75 +386,73 @@ license = ["ukkonen"] [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] [[package]] name = "isort" -version = "5.12.0" +version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] +colors = ["colorama (>=0.4.6)"] [[package]] name = "lazy-object-proxy" -version = "1.9.0" +version = "1.10.0" description = "A fast and thorough lazy object proxy." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "lazy-object-proxy-1.9.0.tar.gz", hash = "sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win32.whl", hash = "sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win32.whl", hash = "sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win32.whl", hash = "sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win_amd64.whl", hash = "sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win32.whl", hash = "sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win_amd64.whl", hash = "sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win32.whl", hash = "sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f"}, + {file = "lazy-object-proxy-1.10.0.tar.gz", hash = "sha256:78247b6d45f43a52ef35c25b5581459e85117225408a4128a3daf8bf9648ac69"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:855e068b0358ab916454464a884779c7ffa312b8925c6f7401e952dcf3b89977"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab7004cf2e59f7c2e4345604a3e6ea0d92ac44e1c2375527d56492014e690c3"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc0d2fc424e54c70c4bc06787e4072c4f3b1aa2f897dfdc34ce1013cf3ceef05"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e2adb09778797da09d2b5ebdbceebf7dd32e2c96f79da9052b2e87b6ea495895"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b1f711e2c6dcd4edd372cf5dec5c5a30d23bba06ee012093267b3376c079ec83"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-win32.whl", hash = "sha256:76a095cfe6045c7d0ca77db9934e8f7b71b14645f0094ffcd842349ada5c5fb9"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:b4f87d4ed9064b2628da63830986c3d2dca7501e6018347798313fcf028e2fd4"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fec03caabbc6b59ea4a638bee5fce7117be8e99a4103d9d5ad77f15d6f81020c"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02c83f957782cbbe8136bee26416686a6ae998c7b6191711a04da776dc9e47d4"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:009e6bb1f1935a62889ddc8541514b6a9e1fcf302667dcb049a0be5c8f613e56"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:75fc59fc450050b1b3c203c35020bc41bd2695ed692a392924c6ce180c6f1dc9"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:782e2c9b2aab1708ffb07d4bf377d12901d7a1d99e5e410d648d892f8967ab1f"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-win32.whl", hash = "sha256:edb45bb8278574710e68a6b021599a10ce730d156e5b254941754a9cc0b17d03"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:e271058822765ad5e3bca7f05f2ace0de58a3f4e62045a8c90a0dfd2f8ad8cc6"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e98c8af98d5707dcdecc9ab0863c0ea6e88545d42ca7c3feffb6b4d1e370c7ba"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:952c81d415b9b80ea261d2372d2a4a2332a3890c2b83e0535f263ddfe43f0d43"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80b39d3a151309efc8cc48675918891b865bdf742a8616a337cb0090791a0de9"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:e221060b701e2aa2ea991542900dd13907a5c90fa80e199dbf5a03359019e7a3"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:92f09ff65ecff3108e56526f9e2481b8116c0b9e1425325e13245abfd79bdb1b"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-win32.whl", hash = "sha256:3ad54b9ddbe20ae9f7c1b29e52f123120772b06dbb18ec6be9101369d63a4074"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:127a789c75151db6af398b8972178afe6bda7d6f68730c057fbbc2e96b08d282"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4ed0518a14dd26092614412936920ad081a424bdcb54cc13349a8e2c6d106a"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ad9e6ed739285919aa9661a5bbed0aaf410aa60231373c5579c6b4801bd883c"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fc0a92c02fa1ca1e84fc60fa258458e5bf89d90a1ddaeb8ed9cc3147f417255"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:0aefc7591920bbd360d57ea03c995cebc204b424524a5bd78406f6e1b8b2a5d8"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5faf03a7d8942bb4476e3b62fd0f4cf94eaf4618e304a19865abf89a35c0bbee"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-win32.whl", hash = "sha256:e333e2324307a7b5d86adfa835bb500ee70bfcd1447384a822e96495796b0ca4"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:cb73507defd385b7705c599a94474b1d5222a508e502553ef94114a143ec6696"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:366c32fe5355ef5fc8a232c5436f4cc66e9d3e8967c01fb2e6302fd6627e3d94"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2297f08f08a2bb0d32a4265e98a006643cd7233fb7983032bd61ac7a02956b3b"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:18dd842b49456aaa9a7cf535b04ca4571a302ff72ed8740d06b5adcd41fe0757"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:217138197c170a2a74ca0e05bddcd5f1796c735c37d0eee33e43259b192aa424"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9a3a87cf1e133e5b1994144c12ca4aa3d9698517fe1e2ca82977781b16955658"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-win32.whl", hash = "sha256:30b339b2a743c5288405aa79a69e706a06e02958eab31859f7f3c04980853b70"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:a899b10e17743683b293a729d3a11f2f399e8a90c73b089e29f5d0fe3509f0dd"}, + {file = "lazy_object_proxy-1.10.0-pp310.pp311.pp312.pp38.pp39-none-any.whl", hash = "sha256:80fa48bd89c8f2f456fc0765c11c23bf5af827febacd2f523ca5bc1893fcc09d"}, ] [[package]] @@ -563,38 +575,38 @@ files = [ [[package]] name = "mypy" -version = "1.6.0" +version = "1.7.1" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:091f53ff88cb093dcc33c29eee522c087a438df65eb92acd371161c1f4380ff0"}, - {file = "mypy-1.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:eb7ff4007865833c470a601498ba30462b7374342580e2346bf7884557e40531"}, - {file = "mypy-1.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49499cf1e464f533fc45be54d20a6351a312f96ae7892d8e9f1708140e27ce41"}, - {file = "mypy-1.6.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4c192445899c69f07874dabda7e931b0cc811ea055bf82c1ababf358b9b2a72c"}, - {file = "mypy-1.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:3df87094028e52766b0a59a3e46481bb98b27986ed6ded6a6cc35ecc75bb9182"}, - {file = "mypy-1.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c8835a07b8442da900db47ccfda76c92c69c3a575872a5b764332c4bacb5a0a"}, - {file = "mypy-1.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:24f3de8b9e7021cd794ad9dfbf2e9fe3f069ff5e28cb57af6f873ffec1cb0425"}, - {file = "mypy-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:856bad61ebc7d21dbc019b719e98303dc6256cec6dcc9ebb0b214b81d6901bd8"}, - {file = "mypy-1.6.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:89513ddfda06b5c8ebd64f026d20a61ef264e89125dc82633f3c34eeb50e7d60"}, - {file = "mypy-1.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:9f8464ed410ada641c29f5de3e6716cbdd4f460b31cf755b2af52f2d5ea79ead"}, - {file = "mypy-1.6.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:971104bcb180e4fed0d7bd85504c9036346ab44b7416c75dd93b5c8c6bb7e28f"}, - {file = "mypy-1.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ab98b8f6fdf669711f3abe83a745f67f50e3cbaea3998b90e8608d2b459fd566"}, - {file = "mypy-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1a69db3018b87b3e6e9dd28970f983ea6c933800c9edf8c503c3135b3274d5ad"}, - {file = "mypy-1.6.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:dccd850a2e3863891871c9e16c54c742dba5470f5120ffed8152956e9e0a5e13"}, - {file = "mypy-1.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:f8598307150b5722854f035d2e70a1ad9cc3c72d392c34fffd8c66d888c90f17"}, - {file = "mypy-1.6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fea451a3125bf0bfe716e5d7ad4b92033c471e4b5b3e154c67525539d14dc15a"}, - {file = "mypy-1.6.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e28d7b221898c401494f3b77db3bac78a03ad0a0fff29a950317d87885c655d2"}, - {file = "mypy-1.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4b7a99275a61aa22256bab5839c35fe8a6887781862471df82afb4b445daae6"}, - {file = "mypy-1.6.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7469545380dddce5719e3656b80bdfbb217cfe8dbb1438532d6abc754b828fed"}, - {file = "mypy-1.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:7807a2a61e636af9ca247ba8494031fb060a0a744b9fee7de3a54bed8a753323"}, - {file = "mypy-1.6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d2dad072e01764823d4b2f06bc7365bb1d4b6c2f38c4d42fade3c8d45b0b4b67"}, - {file = "mypy-1.6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b19006055dde8a5425baa5f3b57a19fa79df621606540493e5e893500148c72f"}, - {file = "mypy-1.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31eba8a7a71f0071f55227a8057468b8d2eb5bf578c8502c7f01abaec8141b2f"}, - {file = "mypy-1.6.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e0db37ac4ebb2fee7702767dfc1b773c7365731c22787cb99f507285014fcaf"}, - {file = "mypy-1.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:c69051274762cccd13498b568ed2430f8d22baa4b179911ad0c1577d336ed849"}, - {file = "mypy-1.6.0-py3-none-any.whl", hash = "sha256:9e1589ca150a51d9d00bb839bfeca2f7a04f32cd62fad87a847bc0818e15d7dc"}, - {file = "mypy-1.6.0.tar.gz", hash = "sha256:4f3d27537abde1be6d5f2c96c29a454da333a2a271ae7d5bc7110e6d4b7beb3f"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:12cce78e329838d70a204293e7b29af9faa3ab14899aec397798a4b41be7f340"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1484b8fa2c10adf4474f016e09d7a159602f3239075c7bf9f1627f5acf40ad49"}, + {file = "mypy-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31902408f4bf54108bbfb2e35369877c01c95adc6192958684473658c322c8a5"}, + {file = "mypy-1.7.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f2c2521a8e4d6d769e3234350ba7b65ff5d527137cdcde13ff4d99114b0c8e7d"}, + {file = "mypy-1.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:fcd2572dd4519e8a6642b733cd3a8cfc1ef94bafd0c1ceed9c94fe736cb65b6a"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4b901927f16224d0d143b925ce9a4e6b3a758010673eeded9b748f250cf4e8f7"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2f7f6985d05a4e3ce8255396df363046c28bea790e40617654e91ed580ca7c51"}, + {file = "mypy-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:944bdc21ebd620eafefc090cdf83158393ec2b1391578359776c00de00e8907a"}, + {file = "mypy-1.7.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9c7ac372232c928fff0645d85f273a726970c014749b924ce5710d7d89763a28"}, + {file = "mypy-1.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:f6efc9bd72258f89a3816e3a98c09d36f079c223aa345c659622f056b760ab42"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6dbdec441c60699288adf051f51a5d512b0d818526d1dcfff5a41f8cd8b4aaf1"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4fc3d14ee80cd22367caaaf6e014494415bf440980a3045bf5045b525680ac33"}, + {file = "mypy-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c6e4464ed5f01dc44dc9821caf67b60a4e5c3b04278286a85c067010653a0eb"}, + {file = "mypy-1.7.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:d9b338c19fa2412f76e17525c1b4f2c687a55b156320acb588df79f2e6fa9fea"}, + {file = "mypy-1.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:204e0d6de5fd2317394a4eff62065614c4892d5a4d1a7ee55b765d7a3d9e3f82"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:84860e06ba363d9c0eeabd45ac0fde4b903ad7aa4f93cd8b648385a888e23200"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8c5091ebd294f7628eb25ea554852a52058ac81472c921150e3a61cdd68f75a7"}, + {file = "mypy-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40716d1f821b89838589e5b3106ebbc23636ffdef5abc31f7cd0266db936067e"}, + {file = "mypy-1.7.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cf3f0c5ac72139797953bd50bc6c95ac13075e62dbfcc923571180bebb662e9"}, + {file = "mypy-1.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:78e25b2fd6cbb55ddfb8058417df193f0129cad5f4ee75d1502248e588d9e0d7"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:75c4d2a6effd015786c87774e04331b6da863fc3fc4e8adfc3b40aa55ab516fe"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2643d145af5292ee956aa0a83c2ce1038a3bdb26e033dadeb2f7066fb0c9abce"}, + {file = "mypy-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75aa828610b67462ffe3057d4d8a4112105ed211596b750b53cbfe182f44777a"}, + {file = "mypy-1.7.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ee5d62d28b854eb61889cde4e1dbc10fbaa5560cb39780c3995f6737f7e82120"}, + {file = "mypy-1.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:72cf32ce7dd3562373f78bd751f73c96cfb441de147cc2448a92c1a308bd0ca6"}, + {file = "mypy-1.7.1-py3-none-any.whl", hash = "sha256:f7c5d642db47376a0cc130f0de6d055056e010debdaf0707cd2b0fc7e7ef30ea"}, + {file = "mypy-1.7.1.tar.gz", hash = "sha256:fcb6d9afb1b6208b4c712af0dafdc650f518836065df0d4fb1d800f5d6773db2"}, ] [package.dependencies] @@ -604,6 +616,7 @@ typing-extensions = ">=4.1.0" [package.extras] dmypy = ["psutil (>=4.0)"] install-types = ["pip"] +mypyc = ["setuptools (>=50)"] reports = ["lxml"] [[package]] @@ -867,13 +880,13 @@ test = ["pytest", "pytest-cov"] [[package]] name = "types-openpyxl" -version = "3.1.0.27" +version = "3.1.0.32" description = "Typing stubs for openpyxl" optional = false python-versions = ">=3.7" files = [ - {file = "types-openpyxl-3.1.0.27.tar.gz", hash = "sha256:1498a9b55965df2d91a46ea65698f60bc3a44e1151875497835a387e3d1de6e4"}, - {file = "types_openpyxl-3.1.0.27-py3-none-any.whl", hash = "sha256:e580b49e7682589d25f49b3df84afaeafbc9715b64cf163a2e1ba45955fe0357"}, + {file = "types-openpyxl-3.1.0.32.tar.gz", hash = "sha256:3d37da6490fc4ed04f1d79c0f523b31197d559043cbc90cbd15acab542a0267b"}, + {file = "types_openpyxl-3.1.0.32-py3-none-any.whl", hash = "sha256:d347f177783dde0f3970aa4a32f808932a269f93809aa953a2bf33bc92b25eb1"}, ] [[package]] @@ -900,13 +913,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.8.0" +version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, - {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, + {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, + {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] [[package]] @@ -922,18 +935,17 @@ files = [ [[package]] name = "urllib3" -version = "2.0.7" +version = "2.1.0" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, - {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, + {file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"}, + {file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -1039,4 +1051,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "49ddfd3afd505218316754042963b5ad0bd71439e171505e1cc8dc7de17a2852" +content-hash = "c02ce43db5856ae08eed8351812bc86df1833e0cb6ca529e967bda399eadce50" diff --git a/pyproject.toml b/pyproject.toml index 2bd422f3..ff7b55ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ django-phonenumber-field = {extras = ["phonenumbers"], version = "^7.2.0"} [tool.poetry.group.dev.dependencies] isort = "^5.12.0" pre-commit = "3.5.0" +django-extensions = "^3.2.3" [tool.poetry.group.test.dependencies] flake8 = "^6.1.0" @@ -52,6 +53,7 @@ mypy_path = "./adaptive_hockey_federation" module = [ "adaptive_hockey_federation.core.user_card", "adaptive_hockey_federation.parser.*", + "phonenumber_field.*" ] ignore_missing_imports = true diff --git a/requirements/develop.txt b/requirements/develop.txt index 76ea2b31..1f2e3685 100644 --- a/requirements/develop.txt +++ b/requirements/develop.txt @@ -2,26 +2,29 @@ asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0" cfgv==3.4.0 ; python_version >= "3.11" and python_version < "4.0" click==8.1.7 ; python_version >= "3.11" and python_version < "4.0" colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows" -distlib==0.3.7 ; python_version >= "3.11" and python_version < "4.0" -django==4.2.7 ; python_version >= "3.11" and python_version < "4.0" +distlib==0.3.8 ; python_version >= "3.11" and python_version < "4.0" +django-extensions==3.2.3 ; python_version >= "3.11" and python_version < "4.0" +django-phonenumber-field[phonenumbers]==7.2.0 ; python_version >= "3.11" and python_version < "4.0" +django==4.2.8 ; python_version >= "3.11" and python_version < "4.0" et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0" filelock==3.13.1 ; python_version >= "3.11" and python_version < "4.0" gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0" identify==2.5.33 ; python_version >= "3.11" and python_version < "4.0" -isort==5.12.0 ; python_version >= "3.11" and python_version < "4.0" +isort==5.13.2 ; python_version >= "3.11" and python_version < "4.0" mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0" -mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0" +mypy==1.7.1 ; python_version >= "3.11" and python_version < "4.0" nodeenv==1.8.0 ; python_version >= "3.11" and python_version < "4.0" openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0" openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0" packaging==23.2 ; python_version >= "3.11" and python_version < "4.0" +phonenumbers==8.13.26 ; python_version >= "3.11" and python_version < "4.0" platformdirs==4.1.0 ; python_version >= "3.11" and python_version < "4.0" pre-commit==3.5.0 ; python_version >= "3.11" and python_version < "4.0" pyyaml==6.0.1 ; python_version >= "3.11" and python_version < "4.0" setuptools==69.0.2 ; python_version >= "3.11" and python_version < "4.0" sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0" -types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0" -typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0" +types-openpyxl==3.1.0.32 ; python_version >= "3.11" and python_version < "4.0" +typing-extensions==4.9.0 ; python_version >= "3.11" and python_version < "4.0" tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32" virtualenv==20.25.0 ; python_version >= "3.11" and python_version < "4.0" wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" \ No newline at end of file diff --git a/requirements/production.txt b/requirements/production.txt index 824d74cf..4ff597ac 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,16 +1,18 @@ asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0" click==8.1.7 ; python_version >= "3.11" and python_version < "4.0" colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows" -django==4.2.7 ; python_version >= "3.11" and python_version < "4.0" +django-phonenumber-field[phonenumbers]==7.2.0 ; python_version >= "3.11" and python_version < "4.0" +django==4.2.8 ; python_version >= "3.11" and python_version < "4.0" et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0" gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0" mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0" -mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0" +mypy==1.7.1 ; python_version >= "3.11" and python_version < "4.0" openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0" openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0" packaging==23.2 ; python_version >= "3.11" and python_version < "4.0" +phonenumbers==8.13.26 ; python_version >= "3.11" and python_version < "4.0" sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0" -types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0" -typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0" +types-openpyxl==3.1.0.32 ; python_version >= "3.11" and python_version < "4.0" +typing-extensions==4.9.0 ; python_version >= "3.11" and python_version < "4.0" tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32" wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" \ No newline at end of file From 24be2475b4af81842834357e7e4ee248acc43efd Mon Sep 17 00:00:00 2001 From: Konstantin Raikhert Date: Tue, 19 Dec 2023 17:47:49 +0300 Subject: [PATCH 4/5] fix flake8 mypy errors --- .pre-commit-config.yaml | 1 + adaptive_hockey_federation/users/models.py | 18 ++++++++---------- pyproject.toml | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f98c16df..55b13fc4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,7 @@ repos: additional_dependencies: - django-stubs - django-environ + - django-phonenumber-field[phonenumbers] - repo: local hooks: diff --git a/adaptive_hockey_federation/users/models.py b/adaptive_hockey_federation/users/models.py index 1046d6ad..697471e7 100644 --- a/adaptive_hockey_federation/users/models.py +++ b/adaptive_hockey_federation/users/models.py @@ -1,11 +1,3 @@ -from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin -from django.core.mail import send_mail -from django.db import models -from django.utils import timezone -from django.utils.translation import gettext_lazy as _ -from phonenumber_field.modelfields import PhoneNumberField -from phonenumber_field.validators import validate_international_phonenumber - from core.constants import ( EMAIL_MAX_LENGTH, NAME_MAX_LENGTH, @@ -15,8 +7,14 @@ ROLE_MODERATOR, ROLES_CHOICES, ) - -from .managers import CustomUserManager +from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin +from django.core.mail import send_mail +from django.db import models +from django.utils import timezone +from django.utils.translation import gettext_lazy as _ +from phonenumber_field.modelfields import PhoneNumberField +from phonenumber_field.validators import validate_international_phonenumber +from users.managers import CustomUserManager class User(AbstractBaseUser, PermissionsMixin): diff --git a/pyproject.toml b/pyproject.toml index 6c5786ae..8f02fcb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ exclude = [ module = [ "adaptive_hockey_federation.parser.user_card", "adaptive_hockey_federation.parser.*", + "phonenumber_field.*", ] ignore_missing_imports = true From e56324859c848641737a6668c4bcfb630d4f45d6 Mon Sep 17 00:00:00 2001 From: Konstantin Raikhert Date: Tue, 19 Dec 2023 17:58:30 +0300 Subject: [PATCH 5/5] fix django extensions/ --- Makefile | 1 + adaptive_hockey_federation/core/config/dev_settings.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f71e5cd0..aff89ba4 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ help: @echo " run - $(SHELL_GREEN)Команда для локального запуска проекта.$(SHELL_NC)" @echo " fill-db - $(SHELL_GREEN)Команда для заполнения базы данных с помощью парсера.$(SHELL_NC)" @echo " pytest - $(SHELL_GREEN)Команда для прогона юнит тестов pytest.$(SHELL_NC)" + @echo " shell - $(SHELL_GREEN)Команда для запуска Django-shell_plus.$(SHELL_NC)" @echo " help - $(SHELL_GREEN)Команда вызова справки.$(SHELL_NC)" @echo "$(SHELL_YELLOW)Для запуска исполнения команд используйте данные ключи совместно с командой 'make', например 'make init-app'." @echo "При запуске команды 'make' без какого либо ключа, происходит вызов справки.$(SHELL_NC)" diff --git a/adaptive_hockey_federation/core/config/dev_settings.py b/adaptive_hockey_federation/core/config/dev_settings.py index 68da3c9a..89a293ba 100644 --- a/adaptive_hockey_federation/core/config/dev_settings.py +++ b/adaptive_hockey_federation/core/config/dev_settings.py @@ -7,10 +7,12 @@ env.read_env(ROOT_DIR / '.env') -EXTERNAL_APPS += [ +DEV_APPS = [ 'django_extensions', ] +INSTALLED_APPS += DEV_APPS + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3',