diff --git a/competition/models.py b/competition/models.py index 140204d..132e25c 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 3222368..eb60b12 100644 --- a/competition/serializers.py +++ b/competition/serializers.py @@ -42,6 +42,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)