diff --git a/board/models.py b/board/models.py index 25b6b73..bf85060 100644 --- a/board/models.py +++ b/board/models.py @@ -143,6 +143,10 @@ class Post(models.Model): ) def clean(self): + # Make sure there is at least some content + self.text = self.text.strip() + if not (self.text or self.image): + raise ValidationError("Please either write a message or upload an image") # Image upload size check if self.image and self.image.size > settings.MAX_UPLOAD_SIZE: raise ValidationError(