add re-validation in python
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user