-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into dev
- Loading branch information
Showing
1 changed file
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,78 @@ | ||
from django.db import models # noqa | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
class Team(models.Model): | ||
"""Класс команды | ||
""" | ||
name = models.CharField( | ||
max_length=256, | ||
verbose_name='Название', | ||
) | ||
|
||
class Meta: | ||
verbose_name = 'Команда' | ||
verbose_name_plural = 'Команды' | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
|
||
class Position(models.Model): | ||
"""Позиция в команде | ||
""" | ||
name = models.CharField( | ||
max_length=256, | ||
verbose_name='Название', | ||
) | ||
|
||
class Meta: | ||
verbose_name = 'Позиция' | ||
verbose_name_plural = 'Позиции' | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
|
||
class BaseUserInfo(models.Model): | ||
"""Класс игрока | ||
""" | ||
CLS_CHOICES = [ | ||
('A', 'A'), | ||
('A2', 'A2'), | ||
('B', 'B'), | ||
('B2', 'B2'), | ||
('C', 'C'), | ||
('C2', 'C2'), | ||
] | ||
name = models.CharField( | ||
max_length=56, | ||
verbose_name='Имя', | ||
) | ||
surname = models.CharField( | ||
max_length=56, | ||
) | ||
date_of_birth = models.DateTimeField( | ||
verbose_name='Дата рождения', | ||
) | ||
team = models.ForeignKey( | ||
to=Team, | ||
on_delete=models.SET_NULL, | ||
blank=True, | ||
null=True, | ||
verbose_name='Команда', | ||
) | ||
position = models.ForeignKey( | ||
to=Team, | ||
on_delete=models.SET_NULL, | ||
blank=True, | ||
null=True, | ||
verbose_name='Позиция', | ||
) | ||
classification = models.CharField( | ||
max_length=255, | ||
choices=CLS_CHOICES, | ||
default=None, | ||
) | ||
|
||
def __str__(self): | ||
return self.name |