diff --git a/insalan/tournament/models/event.py b/insalan/tournament/models/event.py index 1f4c30f7..fa052370 100644 --- a/insalan/tournament/models/event.py +++ b/insalan/tournament/models/event.py @@ -52,6 +52,15 @@ class Event(models.Model): FileExtensionValidator(allowed_extensions=["png", "jpg", "jpeg", "svg", "webp", "avif"]) ], ) + poster: models.FileField = ImageField( + verbose_name=_("Affiche"), + blank=True, + null=True, + upload_to="event-posters", + validators=[ + FileExtensionValidator(allowed_extensions=["png", "jpg", "jpeg", "svg", "webp", "avif"]) + ], + ) class Meta: """Meta options""" diff --git a/insalan/tournament/serializers.py b/insalan/tournament/serializers.py index 1c639ea7..6959cebb 100644 --- a/insalan/tournament/serializers.py +++ b/insalan/tournament/serializers.py @@ -108,6 +108,7 @@ class Meta: "ongoing", "tournaments", "logo", + "poster", ] diff --git a/insalan/tournament/tests.py b/insalan/tournament/tests.py index 3e0a18b2..a569251b 100644 --- a/insalan/tournament/tests.py +++ b/insalan/tournament/tests.py @@ -1185,6 +1185,7 @@ def test_example(self): "month": 12, "ongoing": False, "logo": None, + "poster": None, "seats": [ ( seat_one.x, @@ -1467,6 +1468,7 @@ def test_deref_not_announced(self): } ], "logo": None, + "poster": None, } self.assertEqual(request.data, model) @@ -1531,6 +1533,7 @@ def test_deref(self): } ], "logo": None, + "poster": None, } self.assertEqual(request.data, model)