class BookModelWidget(Block):
def __init__(self, object: Model = None, **kwargs) -> None:
authors = ', '.join([x.full_name for x in object.authors.all()])
super().__init__(
Block(
f"{object.title} - {authors}",
css_class='p-3 mb-1 border text-bg-light'
),
**kwargs
)
class PagedBookWidget(PagedModelWidget):
model = Book
model_widget = BookModelWidget
paginate_by = 5