Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django serializer get image list

   def create(self, validated_data):
       images_data = self.context['request'].FILES
       post = Post.objects.create(**validated_data)
       for image_data in images_data.getlist('image'):
           PostImage.objects.create(post=post, image=image_data)
       return post
 
PREVIOUS NEXT
Tagged: #django #serializer #image #list
ADD COMMENT
Topic
Name
9+6 =