- child_book = Book.objects.get(slug=slug)
- child_book.parent = book
- child_book.parent_number = n
- child_book.save()
-
+ try:
+ child_book = Book.objects.get(slug=slug)
+ child_book.parent = book
+ child_book.parent_number = n
+ child_book.save()
+ except Book.DoesNotExist, e:
+ raise Book.DoesNotExist(u'Book with slug = "%s" does not exist.' % slug)
+