问题
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