+ diff --git a/tournaments/models/club.py b/tournaments/models/club.py index 3f5d624..202ad90 100644 --- a/tournaments/models/club.py +++ b/tournaments/models/club.py @@ -2,7 +2,7 @@ from django.db import models import uuid class Club(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) name = models.CharField(max_length=50) acronym = models.CharField(max_length=10) phone = models.CharField(max_length=15, null=True, blank=True) diff --git a/tournaments/models/custom_user.py b/tournaments/models/custom_user.py index 001b6da..d3784ee 100644 --- a/tournaments/models/custom_user.py +++ b/tournaments/models/custom_user.py @@ -5,7 +5,7 @@ import uuid class CustomUser(AbstractUser): pass - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) umpire_code = models.CharField(max_length=50, blank=True, null=True) clubs = models.ManyToManyField(Club) phone = models.CharField(max_length=15, null=True, blank=True) diff --git a/tournaments/models/event.py b/tournaments/models/event.py index 8bdbc9a..dcd0838 100644 --- a/tournaments/models/event.py +++ b/tournaments/models/event.py @@ -3,7 +3,7 @@ from . import Club, FederalMatchCategory import uuid class Event(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) club = models.ForeignKey(Club, on_delete=models.CASCADE) date = models.DateTimeField() name = models.CharField(max_length=200, null=True, blank=True) diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index e0e15c3..f2b44b3 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -3,7 +3,7 @@ from . import Tournament, FederalMatchCategory import uuid class GroupStage(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) tournament = models.ForeignKey(Tournament, on_delete=models.CASCADE) index = models.IntegerField(null=True, blank=True) format = models.IntegerField(default=FederalMatchCategory.NINE_GAMES, choices=FederalMatchCategory.choices, null=True, blank=True) diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 1f7a029..bb1768e 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -4,7 +4,7 @@ from django.utils import timezone import uuid class Match(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) round = models.ForeignKey(Round, null=True, blank=True, on_delete=models.CASCADE) group_stage = models.ForeignKey(GroupStage, null=True, blank=True, on_delete=models.CASCADE) start_date = models.DateTimeField(null=True, blank=True) diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py index 8a9b5e4..c7fa003 100644 --- a/tournaments/models/player_registration.py +++ b/tournaments/models/player_registration.py @@ -3,7 +3,7 @@ from . import TeamRegistration import uuid class PlayerRegistration(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) diff --git a/tournaments/models/round.py b/tournaments/models/round.py index 716bb99..729c3d7 100644 --- a/tournaments/models/round.py +++ b/tournaments/models/round.py @@ -3,7 +3,7 @@ from . import Tournament, FederalMatchCategory import uuid class Round(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) tournament = models.ForeignKey(Tournament, on_delete=models.CASCADE) index = models.IntegerField(null=True, blank=True) loser = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE) diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index 05460fb..e8ba4aa 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -3,7 +3,7 @@ from . import Tournament, GroupStage import uuid class TeamRegistration(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) tournament = models.ForeignKey(Tournament, on_delete=models.CASCADE) group_stage = models.ForeignKey(GroupStage, null=True, blank=True, on_delete=models.SET_NULL) registration_date = models.DateTimeField(null=True, blank=True) diff --git a/tournaments/models/team_score.py b/tournaments/models/team_score.py index 4aa6008..f149b50 100644 --- a/tournaments/models/team_score.py +++ b/tournaments/models/team_score.py @@ -3,7 +3,7 @@ from . import Match, TeamRegistration, PlayerRegistration import uuid class TeamScore(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) match = models.ForeignKey(Match, on_delete=models.CASCADE, related_name="team_scores") team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE, null=True, blank=True) player_registrations = models.ManyToManyField(PlayerRegistration, blank=True) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index a707003..40eb5ea 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -3,7 +3,7 @@ from . import Event, CustomUser, FederalMatchCategory, FederalCategory, FederalL import uuid class Tournament(models.Model): - id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) event = models.ForeignKey(Event, blank=True, null=True, on_delete=models.CASCADE) creator = models.ForeignKey(CustomUser, blank=True, null=True, on_delete=models.CASCADE) name = models.CharField(max_length=200, null=True, blank=True) diff --git a/tournaments/serializers.py b/tournaments/serializers.py index f845c73..6f52115 100644 --- a/tournaments/serializers.py +++ b/tournaments/serializers.py @@ -67,8 +67,9 @@ class MatchSerializer(serializers.ModelSerializer): class TeamScoreSerializer(serializers.ModelSerializer): class Meta: # match_id = serializers.PrimaryKeyRelatedField(queryset=Match.objects.all()) + # player_registrations_ids = serializers.Man model = TeamScore - fields = ['id', 'match_id', 'score', 'walk_out', 'lucky_loser'] + fields = ['id', 'match_id', 'score', 'walk_out', 'lucky_loser', 'player_registrations'] class TeamRegistrationSerializer(serializers.ModelSerializer): class Meta: diff --git a/tournaments/static/tournaments/Padeltest.html b/tournaments/static/tournaments/Padeltest.html index 461ef1e..d389472 100644 --- a/tournaments/static/tournaments/Padeltest.html +++ b/tournaments/static/tournaments/Padeltest.html @@ -5,7 +5,7 @@ - +
+