1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- from django.db import models
- from webservice_running.models import Sport, Event, Achievements, GENDERS
- from metaservicesynced.models import Client
- class Sportsman(models.Model):
- """
- Определяет дополнительные поля для сервиса "Друг-спортсмен".
- Дополнительные данные, связанные с функционалом пользователя.
- """
- client = models.ForeignKey(Client, on_delete=models.DO_NOTHING, help_text="клиент, которому соответствует роль спортсмена")
- bio = models.CharField(blank=True, max_length=512, help_text="")
- level = models.FloatField(default=0, help_text="")
- birthdate = models.DateField(null=True, blank=True, help_text="")
- active_status = models.CharField(max_length=64, default="Active", help_text="")
- time_updated = models.DateTimeField(blank=True, null=True, help_text="")
- preferred_time = models.CharField(max_length=128, blank=True, help_text="список дней и времени")
- reliance_rating = models.FloatField(default=0)
- # blocked_sportsman = models.ManyToManyField("self", db_table="sportsman_blocked")
- blocked_sportsman = models.ManyToManyField("self",
- through="BlockedSportsman",
- through_fields=("sportsman", "sportsman_blocked"))
- browse_sportsman = models.ManyToManyField("self",
- through="BrowseSportsman",
- through_fields=("sportsman", "sportsman_browsed"))
- saved_sportsman = models.ManyToManyField("self",
- through="SavedSportsman",
- through_fields=("sportsman", "sportsman_saved"))
- sport_preferrence = models.ManyToManyField(Sport,
- through="SportPreferrence",
- through_fields=("sportsman", "sport"))
- achievement = models.ManyToManyField(Achievements,
- through="Achievement",
- through_fields=("sportsman", "achievement"))
- saved_event = models.ManyToManyField(Event,
- through="SavedEvent",
- through_fields=("sportsman", "event_savedevent"))
- participant = models.ManyToManyField(Event,
- through="Participant",
- through_fields=("sportsman", "event_participant"),
- related_name="sportsman_participant")
- browse_event = models.ManyToManyField(Event,
- through="BrowseEvent",
- through_fields=("sportsman", "event_browseevent"),
- related_name="sportsman_browseevent")
- gender = models.CharField(max_length=1, choices=GENDERS, default=None, null=True, blank=True)
- class Meta:
- db_table = "sportsman"
- verbose_name = "Спортсмена"
- verbose_name_plural = "Спортсмены"
|