X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/854b0db58a805fd7ec2d262abda0aef02ca6e469..84aecebd96f2bc8a27396ecf10c409a8b91e1bcc:/apps/catalogue/models.py diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 1e85cdf01..98e37c1af 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -173,7 +173,7 @@ def book_upload_path(ext=None): # how to put related book's slug here? if not ext: ext = media.type - return 'lektura/%s.%s' % (slugify(filename), ext) + return 'lektura/%s.%s' % (slugify(media.name), ext) return get_dynamic_path @@ -206,8 +206,9 @@ class Book(models.Model): html_file = models.FileField(_('HTML file'), upload_to=book_upload_path('html'), blank=True) pdf_file = models.FileField(_('PDF file'), upload_to=book_upload_path('pdf'), blank=True) epub_file = models.FileField(_('EPUB file'), upload_to=book_upload_path('epub'), blank=True) + txt_file = models.FileField(_('TXT file'), upload_to=book_upload_path('txt'), blank=True) # other files - medias = models.ManyToManyField(BookMedia) + medias = models.ManyToManyField(BookMedia, blank=True) parent = models.ForeignKey('self', blank=True, null=True, related_name='children') objects = models.Manager()