Skip to content

Commit d625068

Browse files
committed
Properly remove "confirm preview" checkbox on broken uploads
When an image uploaded as a sponsor benefit was broken (unparseable), we would incorrectly still show the "confirm preview looks ok" checkbox below the error message. If the user confirmed that the preview (which was non-existant and replaced with an error message) looked OK, we would store an empty image in the database and consider the benefit OK. Instead, we're of course not supposed to show the preview checkbox at all if the image uploaded is broken.
1 parent de4e82c commit d625068

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

postgresqleu/confsponsor/benefitclasses/imageupload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def clean(self):
7575
if 'image' not in self._errors:
7676
# Unless there is an error already flagged in the clean_image method
7777
self._errors['image'] = self.error_class(['This field is required'])
78-
self._delete_stage2_fields()
78+
79+
self._delete_stage2_fields()
7980

8081
return self.cleaned_data
8182

0 commit comments

Comments
 (0)