Friday, February 28, 2020

Re: Image Upload

Hi, 
Have a look herer - 
and

Cheers


On Friday, 28 February 2020 17:05:28 UTC+5:30, Soumen Khatua wrote:
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/bde0c9db-ad47-4808-ab20-4d0b06d16a37%40googlegroups.com.

No comments:

Post a Comment