Skip to content

Commit

Permalink
Merge pull request #300 from ZdruzenieSTROM/284-pri-nahrávaní-publiká…
Browse files Browse the repository at this point in the history
…cie-by-mal-byť-optional-name

Pridaná možnosť pomenovať publikáciu
  • Loading branch information
mmihalik authored Dec 8, 2023
2 parents 1b0a310 + f133539 commit 39c1e8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion competition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,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):
Expand Down
3 changes: 2 additions & 1 deletion competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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,
Expand Down

0 comments on commit 39c1e8a

Please sign in to comment.