X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/dbe845386fa136ccb8571e50dadb3c882661a59b..05de464fd2f287d8ea3a26560c18afcac32d7f1e:/apps/catalogue/models.py?ds=inline diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index db194347e..05009a5bc 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -78,9 +78,10 @@ class Book(models.Model): # Formats xml_file = models.FileField(_('XML file'), upload_to='books/xml', blank=True) + html_file = models.FileField(_('HTML file'), upload_to='books/html', blank=True) pdf_file = models.FileField(_('PDF file'), upload_to='books/pdf', blank=True) odt_file = models.FileField(_('ODT file'), upload_to='books/odt', blank=True) - html_file = models.FileField(_('HTML file'), upload_to='books/html', blank=True) + txt_file = models.FileField(_('TXT file'), upload_to='books/txt', blank=True) parent = models.ForeignKey('self', blank=True, null=True, related_name='children') @@ -136,7 +137,8 @@ class Book(models.Model): # Read book metadata book_info = dcparser.parse(xml_file) - book = Book(title=book_info.title, slug=slughifi(book_info.title)) + book_base, book_slug = book_info.url.rsplit('/', 1) + book = Book(title=book_info.title, slug=book_slug) book.save() book_tags = []