json - Django REST API configurations receiving image from android -
hi new django , using create web service. connecting android django , upload , image android django imagefield. using serializer save data in json. code works on normal web, however, not sure image file format send on server , how configure server's file handling
this views.py
looks :
`def post(self, request): serializer = photoserializer(data=request.data) if serializer.is_valid(): serializer.save() return response(serializer.data, status=status.http_201_created) return response(serializer.errors, status=status.http_400_bad_request)`
hi should try create serializers class save image way:
class modelnamesaveserializers(serializers.modelserializer): image_field = serializers.imagefield() class meta: model = modelname fields = ('id'.. antoher_fields, 'image_field')
Comments
Post a Comment