You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
padelclub_backend/tournaments/models/draw_log.py

22 lines
721 B

from django.db import models
from . import SideStoreModel
import uuid
class DrawLog(SideStoreModel):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True)
tournament = models.ForeignKey('Tournament', on_delete=models.CASCADE)
draw_date = models.DateTimeField()
draw_seed = models.IntegerField()
draw_match_index = models.IntegerField()
draw_team_position = models.IntegerField()
draw_type = models.IntegerField(default=0)
def __str__(self):
return f'{self.draw_date}'
def save(self, *args, **kwargs):
self.store_id = str(self.tournament_id())
super().save(*args, **kwargs)
def tournament_id(self):
return self.tournament.id