diff --git a/competition/models.py b/competition/models.py index 6dff6385..7bf523b2 100644 --- a/competition/models.py +++ b/competition/models.py @@ -625,7 +625,7 @@ def generate_name(self, forced=False): if self.order: self.name = f'{self.order}' else: - self.name = type.name + self.name = self.publication_type.name self.save() def __str__(self): diff --git a/competition/views.py b/competition/views.py index 548b6a3c..ad6f743a 100644 --- a/competition/views.py +++ b/competition/views.py @@ -850,7 +850,7 @@ def download_publication(self, request, pk=None): return response @action(methods=['post'], detail=False, url_path='upload', permission_classes=[IsAdminUser]) - def upload_publication(self, request): + def upload_publication(self, request: Request): """Nahrá súbor publikácie""" if 'file' not in request.data: raise exceptions.ParseError(detail='Request neobsahoval súbor') @@ -868,6 +868,7 @@ def upload_publication(self, request): event=event, order=order).first() if publication is None: publication = Publication.objects.create( + name=request.data.get('name'), file=file, event=event, order=order,