Skip to content
Snippets Groups Projects
Commit eb79fc15 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

file_url validation

parent bcbc0666
Branches
Tags
No related merge requests found
Pipeline #3182 passed
......@@ -44,6 +44,8 @@ class DocumentSerializer(serializers.ModelSerializer):
return obj.uploaded_by.full_name
def get_file_url(self, obj):
if not obj.file:
return ""
return f"/api/v1/documents/{obj.id}/download/"
def validate_solution(self, value):
......@@ -54,5 +56,6 @@ class DocumentSerializer(serializers.ModelSerializer):
uploaded_by=profile, solution=value).count()
if count >= _max_count:
raise serializers.ValidationError(
f'You cant upload more than {_max_count} document to one solution!')
f'You cant upload more than {_max_count}\
document to one solution!')
return value
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment