mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
ConstanceForm save method tweak (#333)
We need to store the actual name of the file, which the storage's save method provides. Otherwise, if we upload a new file with the same name as the already stored file has, the Constance config will keep a link to the old file.
This commit is contained in:
parent
1e751f1afa
commit
98800c0671
1 changed files with 1 additions and 2 deletions
|
|
@ -139,8 +139,7 @@ class ConstanceForm(forms.Form):
|
|||
def save(self):
|
||||
for file_field in self.files:
|
||||
file = self.cleaned_data[file_field]
|
||||
default_storage.save(file.name, file)
|
||||
self.cleaned_data[file_field] = file.name
|
||||
self.cleaned_data[file_field] = default_storage.save(file.name, file)
|
||||
|
||||
for name in settings.CONFIG:
|
||||
if getattr(config, name) != self.cleaned_data[name]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue