diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms_common.py | 7 | ||||
-rw-r--r-- | ishtar_common/models.py | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 22a9e0279..8d57f0e3e 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -1552,9 +1552,10 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): not cleaned_data.get('image', None) and \ not cleaned_data.get('associated_file', None) and \ not cleaned_data.get('associated_url', None): - raise forms.ValidationError(_("You should at least fill one of " - "this field: title, url, image or " - "file.")) + raise forms.ValidationError( + _("You should at least fill one of this field: title, url, " + "image or file. If you have provided an image check that " + "it is not corrupted.")) for rel in models.Document.RELATED_MODELS: if cleaned_data.get(rel, None): return cleaned_data diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 977b80ac6..4662bcc35 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -399,8 +399,9 @@ class ImageModel(models.Model, ImageContainerModel): thumb_filename, self.create_thumb(image, self.THUMB_MAX_SIZE), save=False) - except IOError: - pass + except (IOError, ValueError): + self.thumbnail = None + self.image = None finally: if image: image.close() |