Skip to content

Commit

Permalink
fix: convert flashcards to dicts in view.
Browse files Browse the repository at this point in the history
Co-authored-by: Sverre Nystad <[email protected]>
  • Loading branch information
Knolaisen committed Apr 4, 2024
1 parent 4db4798 commit 3e580eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/flashcards/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def create_flashcards(request):
if serializer.is_valid():
uploaded_files: list[InMemoryUploadedFile] = serializer.validated_data.get("curriculum")
flashcards: list[Flashcard] = process_flashcards(uploaded_files)
return Response(data=flashcards, status=200)

flashcard_dicts = [flashcard.to_dict() for flashcard in flashcards]

return Response(data=flashcard_dicts, status=200)

else:
return Response(serializer.errors, status=400)
Expand Down

0 comments on commit 3e580eb

Please sign in to comment.