Commit 71726083 by Bodor Máté

Add intarface data fields to serializer

parent b059943e
...@@ -3,9 +3,15 @@ from rest_framework import serializers ...@@ -3,9 +3,15 @@ from rest_framework import serializers
from .models import Image from .models import Image
class ImageUpdateSerializer(serializers.Serializer):
name = serializers.CharField(required=False)
description = serializers.CharField(required=False)
class ImageSerializer(serializers.ModelSerializer): class ImageSerializer(serializers.ModelSerializer):
image_file = serializers.FileField(write_only=True) image_file = serializers.FileField(write_only=True)
file_format = serializers.CharField(max_length=10, write_only=True) file_format = serializers.CharField(max_length=10)
size = serializers.IntegerField()
class Meta: class Meta:
model = Image model = Image
...@@ -18,5 +24,7 @@ class ImageSerializer(serializers.ModelSerializer): ...@@ -18,5 +24,7 @@ class ImageSerializer(serializers.ModelSerializer):
"created_at", "created_at",
"uploaded_by_user", "uploaded_by_user",
"created_by", "created_by",
"id",
"size",
) )
read_only_fields = ("created_at", "uploaded_by_user", "created_by", "remote_id", ) read_only_fields = ("created_at", "uploaded_by_user", "created_by", "remote_id", "size", )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment