djangodjango-modelsdjango-appsphotologue

django-photologue upload_to


I have been playing around with django-photologue for a while, and find this a great alternative to all other image handlings apps out there.

One thing though, I also use django-cumulus to push my uploads to my CDN instead of running it on my local machine / server.

When I used imagekit, I could always pass a upload_to='whatever' but I cannot seem to do this with photologue as it automatically inserts the imagefield. How would I go about achieving some sort of an overwrite?

Regards


Solution

  • I think you can hook into the pre_save signal of the Photo model, and change the upload_to field, just before the instance is saved to the database.

    Take a look at this: http://docs.djangoproject.com/en/dev/topics/signals/