Skip to content

Commit

Permalink
feat: add CurriculumSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
SverreNystad authored Apr 4, 2024
1 parent bea32fd commit 0e19d10
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions backend/flashcards/serializer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# serializers.py in your Django app
from rest_framework import serializers


class CurriculumSerializer(serializers.Serializer):
curriculum = serializers.ListField(
child=serializers.FileField(allow_empty_file=False, use_url=False),
)

def validate_curriculum(self, value):
# Check minimum number of files
if len(value) < 1:
raise serializers.ValidationError("At least one file must be uploaded.")
return value

0 comments on commit 0e19d10

Please sign in to comment.