upload multiple images without forms in django

本秂侑毒 提交于 2020-07-10 10:28:15

问题


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.

来源:https://stackoverflow.com/questions/62637036/upload-multiple-images-without-forms-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!