richardbarran / django-photologue

A customizable plug-in photo gallery management application for the Django web framework.
BSD 3-Clause "New" or "Revised" License
676 stars 238 forks source link

date_taken field not correctly handled during single photo upload #80

Closed python-consulting closed 10 years ago

python-consulting commented 10 years ago

The date_taken field of photo is set when saving the ImageModel. However when uploading one photo at a time, the path of the actual image is not the final one. In that latter case EXIF extraction failed because it cannot find the file. Logging path values on ImageModel.save(...) gave me an indication on what was going on. During a gallery upload, this is not the case thanks to the statement : photo.image.save(filename, ContentFile(data))

I am considering a clean patch but I only came up with an hugly hack : calling super(ImageModel, self).save(_args, *_kwargs) before setting the date_taken field :( I ll create a pull request anyway.

python-consulting commented 10 years ago

Ignore the patch as it introduces side effects.

python-consulting commented 10 years ago

I found a better solution. It's clean and working ;)

richardbarran commented 10 years ago

Hi, Any chance you could write a new unit test to show the bug/show that you've fixed it? I'd be happy to do it myself normally - but I'm a bit busy at the moment so it will be a week or so before I can write any code.

richardbarran commented 10 years ago

I've cherry-picked your last commit into Photologue - I haven't tested it, but I trust that your code works as intended!