lukpueh · GitHub

Lukas Puehringer

Currently, 'peps.converters.add_pep_image' does not allow to add an
image that already exists in the database for the same name. As a
consequence images cannot be updated.
This commit modifies 'peps.converters.add_pep_image' to also update
the image db record if the corresponding file has changed as per
'filecmp.cmp'. This requires removing the file prior to the db
update, because the django 'FileField' does not override existing
files.
Alternatives to the ad hoc removal of the file in 'add_pep_image'
include passing a custom 'OverwriteStorage' to the used
'ImageField', see e.g.:
https://code.djangoproject.com/ticket/4339
https://stackoverflow.com/questions/9522759/imagefield-overwrite-image-file-with-same-name
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>

Lukas Puehringer

Test a recent change in `add_pep_image` that allows modifying
images.
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>

@lukpueh

lukpueh

Merged

Read the original on github.com ↗