Uploading images from my browsable API

34 views
Skip to first unread message

Filip Bogdanovski

unread,
Jun 15, 2020, 2:44:45 PM6/15/20
to Django REST framework
Hello everyone,

I was wondering if someone know why my field for uploading pictures is like this? I can't select new pictures from my computer to upload, only ones already uploaded in the model instances through my Admin panel. It looks this way on my all of my routes.


I would also love if someone would help me to return a random image on my /breeds/<int:pk>/random route.

Kind Regards,
Filip
upload1.png

Guilherme Lima

unread,
Jun 19, 2020, 8:59:32 AM6/19/20
to Django REST framework
There is a tutorial step-by-step with this topic in this link: https://www.techiediaries.com/django-rest-image-file-upload-tutorial/

I hope it helps you.
Att, Guilherme.

Filip Bogdanovski

unread,
Jun 19, 2020, 1:51:16 PM6/19/20
to django-res...@googlegroups.com
Hello Guilherme,


Kind Regards,
Filip

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/a99fc494-c7dd-4f88-83ec-077e34691312o%40googlegroups.com.

Yery cs

unread,
Jun 19, 2020, 2:12:28 PM6/19/20
to django-res...@googlegroups.com
Hi, Filip

You are using nested serializer for create operation.
https://stackoverflow.com/questions/39645410/how-to-upload-multiple-files-in-django-rest-framework 
Please refer above url.
If you want to do create operation with nested serializer, you have to do pop operation from nested data and create operation manually for nested data.

Hope it helps.

Filip Bogdanovski

unread,
Jun 19, 2020, 2:21:13 PM6/19/20
to django-res...@googlegroups.com
Hello,

Thank you for your reply, I will try this.

Kind regards,
Filip

Reply all
Reply to author
Forward
0 new messages