+ class Meta:
+ ordering = ['title']
+ verbose_name = _('book')
+ verbose_name_plural = _('books')
+
+ def __unicode__(self):
+ return self.title
+
+ @classmethod
+ def create(cls, creator=None, text=u'', *args, **kwargs):
+ instance = cls(*args, **kwargs)
+ instance.doc = dvcs_models.Document.create(creator=creator, text=text)
+ instance.save()
+ return instance
+
+ @staticmethod
+ def listener_create(sender, instance, created, **kwargs):
+ if created and instance.doc is None:
+ instance.doc = dvcs_models.Document.objects.create()
+ instance.save()
+
+models.signals.post_save.connect(Book.listener_create, sender=Book)