fragments = self.fragments.order_by()
fragments_count = fragments.count()
if not fragments_count and self.children.exists():
fragments = Fragment.objects.filter(book__ancestor=self).order_by()
fragments_count = fragments.count()
if fragments_count:
fragments = self.fragments.order_by()
fragments_count = fragments.count()
if not fragments_count and self.children.exists():
fragments = Fragment.objects.filter(book__ancestor=self).order_by()
fragments_count = fragments.count()
if fragments_count: