From 46d5625b700b598b129bb8087a1c426b060c7a73 Mon Sep 17 00:00:00 2001 From: teryaev-anton Date: Thu, 31 Aug 2023 07:52:33 +0500 Subject: [PATCH] remove user_region and user_role from models and admin --- src/users/admin.py | 5 +---- ...002_remove_user_region_remove_user_role.py | 22 +++++++++++++++++++ src/users/models.py | 13 ----------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 src/users/migrations/0002_remove_user_region_remove_user_role.py diff --git a/src/users/admin.py b/src/users/admin.py index ec016323..ca1ff01e 100644 --- a/src/users/admin.py +++ b/src/users/admin.py @@ -40,13 +40,10 @@ class UserAdmin(BaseUserAdmin): "first_name", "last_name", "email", - "region", "is_staff", - "role", ) - list_editable = ("role",) search_fields = ("first_name", "last_name", "email") - ordering = ("region",) + ordering = ("first_name",) admin.site.register(User, UserAdmin) diff --git a/src/users/migrations/0002_remove_user_region_remove_user_role.py b/src/users/migrations/0002_remove_user_region_remove_user_role.py new file mode 100644 index 00000000..80ec2c10 --- /dev/null +++ b/src/users/migrations/0002_remove_user_region_remove_user_role.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.4 on 2023-08-31 02:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + """Migrations for users.""" + + dependencies = [ + ("users", "0001_initial"), + ] + + operations = [ + migrations.RemoveField( + model_name="user", + name="region", + ), + migrations.RemoveField( + model_name="user", + name="role", + ), + ] diff --git a/src/users/models.py b/src/users/models.py index 4f001a31..5d7a3fa3 100644 --- a/src/users/models.py +++ b/src/users/models.py @@ -2,8 +2,6 @@ from django.db import models from django.utils.translation import gettext_lazy as _ -from core.models import Region - from .manager import UserManager @@ -26,17 +24,6 @@ class UserRole(models.TextChoices): email = models.EmailField( unique=True, verbose_name="Адрес электронной почты" ) - role = models.CharField( - max_length=12, - choices=UserRole.choices, - verbose_name="Роль пользователя", - ) - region = models.ForeignKey( - Region, - on_delete=models.SET_NULL, - null=True, - verbose_name="Регион пользователя", - ) objects = UserManager()