sportsman.py 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. from django.db import models
  2. from webservice_running.models import Sport, Event, Achievements, GENDERS
  3. from metaservicesynced.models import Client
  4. class Sportsman(models.Model):
  5. """
  6. Определяет дополнительные поля для сервиса "Друг-спортсмен".
  7. Дополнительные данные, связанные с функционалом пользователя.
  8. """
  9. client = models.ForeignKey(Client, on_delete=models.DO_NOTHING, help_text="клиент, которому соответствует роль спортсмена")
  10. bio = models.CharField(blank=True, max_length=512, help_text="")
  11. level = models.FloatField(default=0, help_text="")
  12. birthdate = models.DateField(null=True, blank=True, help_text="")
  13. active_status = models.CharField(max_length=64, default="Active", help_text="")
  14. time_updated = models.DateTimeField(blank=True, null=True, help_text="")
  15. preferred_time = models.CharField(max_length=128, blank=True, help_text="список дней и времени")
  16. reliance_rating = models.FloatField(default=0)
  17. # blocked_sportsman = models.ManyToManyField("self", db_table="sportsman_blocked")
  18. blocked_sportsman = models.ManyToManyField("self",
  19. through="BlockedSportsman",
  20. through_fields=("sportsman", "sportsman_blocked"))
  21. browse_sportsman = models.ManyToManyField("self",
  22. through="BrowseSportsman",
  23. through_fields=("sportsman", "sportsman_browsed"))
  24. saved_sportsman = models.ManyToManyField("self",
  25. through="SavedSportsman",
  26. through_fields=("sportsman", "sportsman_saved"))
  27. sport_preferrence = models.ManyToManyField(Sport,
  28. through="SportPreferrence",
  29. through_fields=("sportsman", "sport"))
  30. achievement = models.ManyToManyField(Achievements,
  31. through="Achievement",
  32. through_fields=("sportsman", "achievement"))
  33. saved_event = models.ManyToManyField(Event,
  34. through="SavedEvent",
  35. through_fields=("sportsman", "event_savedevent"))
  36. participant = models.ManyToManyField(Event,
  37. through="Participant",
  38. through_fields=("sportsman", "event_participant"),
  39. related_name="sportsman_participant")
  40. browse_event = models.ManyToManyField(Event,
  41. through="BrowseEvent",
  42. through_fields=("sportsman", "event_browseevent"),
  43. related_name="sportsman_browseevent")
  44. gender = models.CharField(max_length=1, choices=GENDERS, default=None, null=True, blank=True)
  45. class Meta:
  46. db_table = "sportsman"
  47. verbose_name = "Спортсмена"
  48. verbose_name_plural = "Спортсмены"