This commit is contained in:
rngsurrounded
2025-03-03 05:36:03 +09:00
2 changed files with 2 additions and 3 deletions
+1
View File
@@ -35,6 +35,7 @@ router = Router(tags=["competition"])
) )
def start_competition(request, competition_id: UUID) -> PingOut: def start_competition(request, competition_id: UUID) -> PingOut:
competition = get_object_or_404(Competition, pk=competition_id) competition = get_object_or_404(Competition, pk=competition_id)
competition.participants.add(request.auth)
state_obj, _ = State.objects.update_or_create( state_obj, _ = State.objects.update_or_create(
user=request.auth, competition=competition, state="started" user=request.auth, competition=competition, state="started"
) )
+1 -3
View File
@@ -19,9 +19,7 @@ class CompetitionTask(BaseModel):
def answer_file_upload_to(instance, filename) -> str: def answer_file_upload_to(instance, filename) -> str:
return f"tasks/{instance.id}/answer/{uuid4()}/{filename}" return f"tasks/{instance.id}/answer/{uuid4()}/{filename}"
in_competition_position = models.PositiveSmallIntegerField( in_competition_position = models.PositiveSmallIntegerField()
null=True, blank=True
)
competition = models.ForeignKey(Competition, on_delete=models.CASCADE) competition = models.ForeignKey(Competition, on_delete=models.CASCADE)
title = models.CharField(verbose_name="заголовок", max_length=50) title = models.CharField(verbose_name="заголовок", max_length=50)
description = MartorField(verbose_name="описание") description = MartorField(verbose_name="описание")