Friday, February 28, 2020

Image Upload

Hi Folks,

I'm using DRF APIView to upload images, but I don't know how to write a POST request to accept image. Please advise me how I can do it?

my serializers.py

class ImageSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = ['user','profile_pic']
        extra_kwargs = {
            'user': {'write_only': True}
        }

My models.py contain profile_pic as a ImageField.


Thank you in advance


Regards,
soumen

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6Wax0gjhfSUV0g1h8asaC_av0dA-ntTyETfrWhh%2B6XgZEw%40mail.gmail.com.

No comments:

Post a Comment