From df5a8ec3e287b1fdb949ef03c8f8388263bcac8b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Thu, 11 Dec 2008 16:13:43 +0100 Subject: [PATCH] Fixed importing books from Django admin. --- apps/catalogue/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index ad56496f2..6ab090df7 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -233,7 +233,9 @@ class Book(models.Model): book_descendants += list(child_book.children.all()) # Save XML and HTML files - book.xml_file.save('%s.xml' % book.slug, File(file(xml_file)), save=False) + if not isinstance(xml_file, File): + xml_file = File(file(xml_file)) + book.xml_file.save('%s.xml' % book.slug, xml_file, save=False) html_file = NamedTemporaryFile() if html.transform(book.xml_file.path, html_file): -- 2.20.1