Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in Django fixtures?

Tags:

I was looking at Django fixtures in the docs, there was no mention of preloading images into the database. I can't be the only who needed to do this. Is this possible? If so how? If not, are there any workarounds available?

Please and thank you.

like image 732
myusuf3 Avatar asked Apr 20 '11 04:04

myusuf3


1 Answers

Yes, it's possible. You have to put your image in your project MEDIA_ROOT. In fixtures it will look like

[{     "pk": 1,     "model": "pictures.picture",     "fields": {         "image": "/media/gebakken_kip_met_korianderrijst_1152_x_1728.png"      } }] 
like image 59
srusskih Avatar answered Sep 20 '22 12:09

srusskih