Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django and FeinCMS: A way to use the Media Library in other normal models?

I'm using Django and FeinCMS on a project. I'm currently using FeinCMS for all the pages on the site. But I also have another separate model that handles very simple stock for the site too. This stock model has the usual fields (name, description, etc) but I also want it to have photos.

Because FeinCMS has a media library already, I would like to technically use that to have the photos with my stock model. I could just normally do a Photo model and ManyToManyField that, but I'm curious to know if I can ManyToManyField with the FeinCMS media library?

I know with FeinCMS you can use the item editor on any other model, but I'm not sure that's the right way to go about it. If it's the only way to do this, then that will have to be it.

Many thanks

like image 594
littlejim84 Avatar asked Aug 22 '10 18:08

littlejim84


1 Answers

Sure -- there's nothing stopping you from adding a ForeignKey or a ManyToManyField to the MediaFile model to one of your own models. Note that you'll have a hard time limiting the media files to only images. Maybe limit_choices_to will help though.

like image 115
Matthias Kestenholz Avatar answered Sep 19 '22 16:09

Matthias Kestenholz