here is my models.py :
models.py
class Resource(Document):
instruction = fields.StringField(required=True)
picture = fields.ImageField(required=False)
and my serializer :
class ResourceSerializer(serializers.DocumentSerializer):
class Meta:
model = Resource
fields = '__all__'
and my views.py
class ResourceViewSet(viewsets.ModelViewSet):
lookup_field = 'id'
serializer_class = ResourceSerializer
def get_queryset(self):
return Resource.objects()
and this is the response that i get when im trying to list the pictures
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
[
{
"id": "5ac4886a91a48946801813c9",
"instruction": "test",
"picture": "5ac4886991a48946801813bf"
}
]
note : mongodb using gridfs to storing the imagefiles
in case that mongodb using gridfs to storing the imagefiles , how can i send the images to client ?