diff --git a/adaptive_hockey_federation/main/admin.py b/adaptive_hockey_federation/main/admin.py index 47b20689..7cc80a82 100644 --- a/adaptive_hockey_federation/main/admin.py +++ b/adaptive_hockey_federation/main/admin.py @@ -1,8 +1,14 @@ from django.contrib import admin - from main.models import ( - Anamnesis, Discipline, Health, Location, Player, Position, - RespiratoryFailure, Role, Team, + Anamnesis, + Discipline, + Health, + Location, + Player, + Position, + RespiratoryFailure, + Role, + Team, ) @@ -32,15 +38,8 @@ class PlayerInline(admin.TabularInline): @admin.register(Player) class PlayerAdmin(admin.ModelAdmin): inlines = [TeamInline, HealthInline] - fieldsets = [ - ( - 'Персональные данные', - { - 'fields': ['name', 'surname', 'patronymic', 'birth_date'] - } - ), - ] - list_display = ['name', 'surname', ] + fields = ['name', 'surname', 'patronymic', 'birth_date'] + list_display = ['name', 'surname'] search_fields = ['surname', 'name'] diff --git a/adaptive_hockey_federation/main/models.py b/adaptive_hockey_federation/main/models.py index e53c3f1b..2feaeb5e 100644 --- a/adaptive_hockey_federation/main/models.py +++ b/adaptive_hockey_federation/main/models.py @@ -1,8 +1,6 @@ from django.db.models import ( BooleanField, CASCADE, CharField, DateField, ForeignKey, ManyToManyField, - Model, - SET_NULL, - UniqueConstraint, + Model, SET_NULL, UniqueConstraint, ) SEX_CHOICES = ( @@ -145,7 +143,7 @@ class BasePerson(Model): patronymic = CharField( max_length=BASE_PERSON_FIELD_LENGTH, blank=True, - null=True, + default='', verbose_name='Отчество', ) diff --git a/adaptive_hockey_federation/users/models.py b/adaptive_hockey_federation/users/models.py index fea9dbee..9bc5aa77 100644 --- a/adaptive_hockey_federation/users/models.py +++ b/adaptive_hockey_federation/users/models.py @@ -1,8 +1,5 @@ from django.contrib.auth.models import AbstractUser -from django.db.models import ( - CharField, DateTimeField, EmailField, ForeignKey, SET_NULL, -) - +from django.db.models import SET_NULL, CharField, ForeignKey from main.models import Team NAME_MAX_LENGTH = 256 @@ -23,14 +20,6 @@ class User(AbstractUser): - # username = CharField( - # unique=True, - # max_length=NAME_MAX_LENGTH, - # ) - # email = EmailField( - # unique=True, - # max_length=EMAIL_MAX_LENGTH, - # ) phone = CharField( max_length=PHONE_MAX_LENGTH, ) @@ -41,17 +30,14 @@ class User(AbstractUser): ) first_name = CharField( max_length=NAME_MAX_LENGTH, - blank=True, + default='', null=True, ) last_name = CharField( max_length=NAME_MAX_LENGTH, - blank=True, + default='', null=True, ) - # created = DateTimeField( - # auto_now_add=True, - # ) team = ForeignKey( to=Team, on_delete=SET_NULL,