check if a image exists.

This commit is contained in:
2020-10-30 22:03:14 +00:00
parent a7e778b217
commit 2315b733ce

View File

@@ -127,6 +127,9 @@ class Member(models.Model):
verbose_name_plural = "Mitglieder" verbose_name_plural = "Mitglieder"
def clean(self): def clean(self):
if not self.image:
raise ValidationError(_("Es fehlt das Profilbild."))
if self.image.height < 150 or self.image.width < 150: if self.image.height < 150 or self.image.width < 150:
raise ValidationError( raise ValidationError(
_("Das Bild ist zu klein. (Höhe: {}, Breite: {})").format( _("Das Bild ist zu klein. (Höhe: {}, Breite: {})").format(