add re-validation in python

This commit is contained in:
2025-10-31 01:56:26 +01:00
parent f98145d6db
commit e0ada1e26d
5 changed files with 310 additions and 10 deletions
+4 -7
View File
@@ -3,7 +3,6 @@ from ninja.files import UploadedFile
from ninja.pagination import paginate
from django.db import transaction
from django.core.files.base import ContentFile
from django.http import Http404
from django.utils import timezone
from django.shortcuts import get_object_or_404
from typing import List
@@ -97,12 +96,9 @@ def create_submission(
file_index = 0
for response_data in data.responses:
# Get the puzzle
try:
puzzle = SteamCollectionItem.objects.get(id=response_data.puzzle_id)
except SteamCollectionItem.DoesNotExist:
return 400, {
"detail": f"Puzzle with id {response_data.puzzle_id} not found"
}
puzzle = get_object_or_404(
SteamCollectionItem, id=response_data.puzzle_id
)
# Create the puzzle response
response = PuzzleResponse.objects.create(
@@ -121,6 +117,7 @@ def create_submission(
# Process files for this response
# For simplicity, we'll take one file per response
# In a real implementation, you'd need better file-to-response mapping
print("FI", file_index, files)
if file_index < len(files):
uploaded_file = files[file_index]