add a minimum size of image of members (150x150)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from django.core.validators import RegexValidator
|
||||
from django.core.validators import RegexValidator, ValidationError
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.utils import timezone
|
||||
@@ -114,6 +114,15 @@ class Member(models.Model):
|
||||
verbose_name = "Mitglied"
|
||||
verbose_name_plural = "Mitglieder"
|
||||
|
||||
def clean(self):
|
||||
if self.image.height < 150 or self.image.width < 150:
|
||||
raise ValidationError(
|
||||
_('Das Bild ist zu klein. (Höhe: {}, Breite: {})').format(
|
||||
self.image.height,
|
||||
self.image.width
|
||||
)
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.firstname + " " + self.surname
|
||||
|
||||
|
||||
Reference in New Issue
Block a user