from django.db import models from webservice_running.models import GENDERS from metaservicesynced.models import Orders, Resource class Event(models.Model): ''' Дополнительные данные для сервиса. ''' ### Standart fields order_synced = models.ForeignKey(Orders, on_delete=models.DO_NOTHING) resource_id = models.ForeignKey(Resource, null=True, on_delete=models.DO_NOTHING) rating_id = models.IntegerField(null=True)#Need create table with rating attempts = models.IntegerField(null=True, help_text="Попытки") order_place_type = models.CharField(null=True, max_length=150) order_place_start = models.CharField(null=True, max_length=150) order_place_start_gps = models.CharField(null=True, max_length=150) order_place_start_sector = models.IntegerField(null=True) order_place_start_real = models.CharField(null=True, max_length=150) order_place_start_real_gps = models.CharField(null=True, max_length=150) order_place_finish_predicted = models.CharField(null=True, max_length=150) order_place_finish_predicted_gps = models.CharField(null=True, max_length=150) order_place_finish_sector = models.IntegerField(null=True) order_place_finish_real = models.CharField(null=True, max_length=150) order_place_finish_real_gps = models.CharField(null=True, max_length=150) ### Application fields sport = models.ForeignKey("Sport", on_delete=models.DO_NOTHING) host = models.ForeignKey("Sportsman", on_delete=models.DO_NOTHING) required_gender = models.CharField(max_length=1, choices=GENDERS, default=None, null=True, blank=True) description = models.CharField(max_length=512, blank=True) # Event updated time time_updated = models.DateTimeField(auto_now=True, null=True, blank=True) # Time until which signing up is available time_close = models.DateTimeField(null=True, blank=True) max_participants = models.IntegerField(help_text="максимальное количесво участников") min_participants = models.IntegerField(help_text="минимальное количесво участников") max_age = models.IntegerField(help_text="максимальный возраст для участия") min_age = models.IntegerField(help_text="минимальный возраст для участия") required_level = models.IntegerField(null=True, blank=True, help_text="необходимое минимальное значение в поле level у пользователя для участия") is_public = models.BooleanField(default=True) class Meta: db_table = "event" verbose_name = "мероприятие" verbose_name_plural = "мероприятия"