From 52a0445217d261027b003f6f300c1e0d6a3553eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Sat, 6 Sep 2008 19:09:29 +0200 Subject: [PATCH] Added importing metabooks (books with relation.hasPart in Dublin Core metadata). --- catalogue/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/catalogue/models.py b/catalogue/models.py index e80bd259a..114b34bdd 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -150,6 +150,13 @@ class Book(models.Model): book_tags.append(tag) book.tags = book_tags + if hasattr(book_info, 'parts'): + for part_url in book_info.parts: + base, slug = part_url.rsplit('/', 1) + child_book = Book.objects.get(slug=slug) + child_book.parent = book + child_book.save() + # Save XML and HTML files book.xml_file.save('%s.xml' % book.slug, File(file(xml_file)), save=False) -- 2.20.1