From 7e1024d7280c36362628068b1d17da132b8d52b0 Mon Sep 17 00:00:00 2001 From: Kozin Date: Thu, 11 Apr 2024 19:08:02 +0300 Subject: [PATCH] [*] Fixes. R: The absence of fields with contacts in Project and Draft serializers. FB: Added fields with contscts in Project and Draft serializers. Fix regex for phone_number validator. --- src/backend/api/v1/projects/serializers.py | 3 +++ src/backend/apps/general/constants.py | 2 +- src/backend/apps/profile/migrations/0001_initial.py | 2 +- src/backend/apps/projects/admin.py | 6 ++++++ src/backend/apps/projects/migrations/0001_initial.py | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/backend/api/v1/projects/serializers.py b/src/backend/api/v1/projects/serializers.py index 3d30e26..45f714b 100644 --- a/src/backend/api/v1/projects/serializers.py +++ b/src/backend/api/v1/projects/serializers.py @@ -65,6 +65,9 @@ class Meta: "creator", "owner", "link", + "phone_number", + "telegram_nick", + "email", "project_specialists", "status", ) diff --git a/src/backend/apps/general/constants.py b/src/backend/apps/general/constants.py index 3d26f8d..e00dea0 100644 --- a/src/backend/apps/general/constants.py +++ b/src/backend/apps/general/constants.py @@ -30,7 +30,7 @@ MAX_LENGTH_EMAIL = 256 MAX_LENGTH_PHONE_NUMBER = 12 -PHONE_NUMBER_REGEX = r"^\+7\(\d{3}\)\d{3}-\d{2}-\d{2}$" +PHONE_NUMBER_REGEX = r"^\+7\d{10}$" PHONE_NUMBER_REGEX_ERROR_TEXT = ( "Телефон может содержать: цифры, спецсимволы, длина не должна превышать " "12 символов" diff --git a/src/backend/apps/profile/migrations/0001_initial.py b/src/backend/apps/profile/migrations/0001_initial.py index b1bab13..215376d 100644 --- a/src/backend/apps/profile/migrations/0001_initial.py +++ b/src/backend/apps/profile/migrations/0001_initial.py @@ -36,7 +36,7 @@ class Migration(migrations.Migration): validators=[ django.core.validators.RegexValidator( message="Телефон может содержать: цифры, спецсимволы, длина не должна превышать 12 символов", - regex="^\\+7\\(\\d{3}\\)\\d{3}-\\d{2}-\\d{2}$", + regex="^\\+7\\d{10}$", ) ], verbose_name="Номер телефона", diff --git a/src/backend/apps/projects/admin.py b/src/backend/apps/projects/admin.py index 8bb9de7..a37158a 100644 --- a/src/backend/apps/projects/admin.py +++ b/src/backend/apps/projects/admin.py @@ -31,6 +31,9 @@ def get_queryset(self, request): "started", "ended", "busyness", + "phone_number", + "telegram_nick", + "email", "link", "status", ) @@ -55,6 +58,9 @@ def recruitment_status(self, obj): "ended", "busyness", "link", + "phone_number", + "telegram_nick", + "email", "recruitment_status", "status", ) diff --git a/src/backend/apps/projects/migrations/0001_initial.py b/src/backend/apps/projects/migrations/0001_initial.py index 5607ccf..1c05dee 100644 --- a/src/backend/apps/projects/migrations/0001_initial.py +++ b/src/backend/apps/projects/migrations/0001_initial.py @@ -73,7 +73,7 @@ class Migration(migrations.Migration): validators=[ django.core.validators.RegexValidator( message="Телефон может содержать: цифры, спецсимволы, длина не должна превышать 12 символов", - regex="^\\+7\\(\\d{3}\\)\\d{3}-\\d{2}-\\d{2}$", + regex="^\\+7\\d{10}$", ) ], verbose_name="Номер телефона",