Skip to content

Commit

Permalink
remove user_region and user_role from models and admin
Browse files Browse the repository at this point in the history
  • Loading branch information
teryaev-anton committed Aug 31, 2023
1 parent f468ff0 commit 46d5625
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions src/users/migrations/0002_remove_user_region_remove_user_role.py
Original file line number Diff line number Diff line change
@@ -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",
),
]
13 changes: 0 additions & 13 deletions src/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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()

Expand Down

0 comments on commit 46d5625

Please sign in to comment.