Skip to content

Commit

Permalink
restore deletion, fix bug that deleted image on update
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolerd committed Aug 13, 2015
1 parent b3aef09 commit c73e6cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions project/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ class ImageUploadForm(Form):
DataRequired(),
]
)
else:
delete = BooleanField(
label='Удалить',
description='Эта картинка будет удалена навсегда'
' (очень надолго!)',
)
return ImageUploadForm
2 changes: 1 addition & 1 deletion project/admin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def post(self, entry_id):
)
form = form_class(obj=instance)
if form.validate_on_submit():
if 'delete' in form.data:
if form.data.get('delete', False):
instance.bl.delete()
else:
instance.bl.update(form.data)
Expand Down

0 comments on commit c73e6cf

Please sign in to comment.