0

This is my models.py

class Upload(models.Model):
    images = models.ImageField(upload_to='image/')

serializers.py

class UploadSerializer(serializers.ModelSerializer):

class Meta:
    model = Upload
    fields = '__all__'

views.py

class UploadViewSet(viewsets.ModelViewSet):
queryset = Upload.objects.all()
permission_classes = [
    permissions.AllowAny
]
serializer_class = UploadSerializer

I can successfully upload single image, however django model is not recieving multiple images at once. How to upload multiple images? what should i change in serializers.py or models.py or views.py? any related response is appreciable. Thank you.

Titan
  • 244
  • 1
  • 4
  • 18
  • What would you do if you receive multiple images? Would you save those **N** files as ***separate `Upload` instances***? – JPG Jun 29 '20 at 11:40
  • @ArakkalAbu Yes already i can save images in images folder with the help of upload_to in models.py but only works with single image :( i will then process that images with machine learning, say like image processing. uploading images from react to django is working fine but only single image can be uploaded because i have to change something in Django, but i dont know what to change since i'm not expert in Django. – Titan Jun 29 '20 at 12:12

0 Answers0