Skip to content

Commit

Permalink
Kontrola správnosti competition iba ak je prítomná
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe committed Dec 13, 2024
1 parent 8d1967d commit 20ca8a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion competition/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ def validate(self, attrs):
if attrs.get('season_code', 0) not in (0, 1):
raise ValidationError(
'Seminár musí byť zimný alebo letný(season_code 0 alebo 1)')
if attrs.get('competition').competition_type.name != "Seminár":
competition: models.Competition | None = attrs.get('competition')
if competition and competition.competition_type.name != "Seminár":
raise ValidationError('Súťaž nie je typu seminár')
return super().validate(attrs)

Expand Down

0 comments on commit 20ca8a3

Please sign in to comment.