Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Apply image validator to gallery images (Issue #2054)

Saad Muhammadff9d32aef313
diff --git a/wger/gallery/models/image.py b/wger/gallery/models/image.py
index cca02d53b..82c4a5d42 100644
--- a/wger/gallery/models/image.py
+++ b/wger/gallery/models/image.py
@@ -25,6 +25,9 @@ from django.db import models
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _
+# wger
+from wger.utils.images import validate_image_static_no_animation
+
def gallery_upload_dir(instance, filename):
"""
@@ -53,6 +56,7 @@ class Image(models.Model):
upload_to=gallery_upload_dir,
height_field='height',
width_field='width',
+ validators=[validate_image_static_no_animation],
)
height = models.IntegerField(editable=False)