Fix problème lors de l'édition de version sans image
This commit is contained in:
parent
daf4ab1eeb
commit
b1dcd55ebc
@ -154,7 +154,9 @@ class EventForm(ModelForm):
|
|||||||
super().clean()
|
super().clean()
|
||||||
|
|
||||||
# when cloning an existing event, we need to copy the local image
|
# when cloning an existing event, we need to copy the local image
|
||||||
if self.cleaned_data['local_image'] is None and not self.cleaned_data['old_local_image'] is None:
|
if self.cleaned_data['local_image'] is None and \
|
||||||
|
not self.cleaned_data['old_local_image'] is None and \
|
||||||
|
self.cleaned_data['old_local_image'] != "":
|
||||||
basename = self.cleaned_data['old_local_image']
|
basename = self.cleaned_data['old_local_image']
|
||||||
old = settings.MEDIA_ROOT + "/" + basename
|
old = settings.MEDIA_ROOT + "/" + basename
|
||||||
self.cleaned_data['local_image'] = File(name=basename, file=open(old, "rb"))
|
self.cleaned_data['local_image'] = File(name=basename, file=open(old, "rb"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user