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)