From 4c96ee1e6ff700489b6aa19789688598a935ac39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mih=C3=A1lik?= Date: Sat, 14 Dec 2024 23:27:36 +0100 Subject: [PATCH] Suspicious operation fix (#475) --- competition/models.py | 2 +- competition/serializers.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/competition/models.py b/competition/models.py index 5ed9344..a195784 100644 --- a/competition/models.py +++ b/competition/models.py @@ -736,7 +736,7 @@ class Meta: event = models.ForeignKey(Event, null=True, on_delete=models.SET_NULL) file = RestrictedFileField( - upload_to='publications/%Y', + upload_to='publications/%Y/', content_types=['application/pdf', 'application/zip'], verbose_name='súbor') diff --git a/competition/serializers.py b/competition/serializers.py index ab85c31..0a607a8 100644 --- a/competition/serializers.py +++ b/competition/serializers.py @@ -46,6 +46,11 @@ class Meta: model = models.Publication fields = '__all__' + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.fields['file'].parent = None + def get_verbose_name(self, obj): return str(obj)