Skip to content

Commit

Permalink
Fix generating name of publication
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe committed Apr 12, 2024
1 parent 4a11134 commit d0005ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion competition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property
from django.utils.timezone import now
from unidecode import unidecode

from base.managers import UnspecifiedValueManager
from base.models import RestrictedFileField
Expand Down Expand Up @@ -682,6 +683,10 @@ class Meta:

name = models.CharField(max_length=100, verbose_name='názov typu')

@property
def code(self):
return unidecode(self.name).lower()

def __str__(self):
return self.name

Expand Down Expand Up @@ -714,7 +719,7 @@ def generate_name(self, forced=False):
return

if self.order:
self.name = f'{self.order}'
self.name = f'{self.publication_type.code}_{self.order}.pdf'
else:
self.name = self.publication_type.name
self.save()
Expand Down

0 comments on commit d0005ee

Please sign in to comment.