class TestTable(NoSortTable): icon = Column.icon(is_report) edit = Column.edit(is_report) delete = Column.delete(is_report) download = Column.download(is_report) run = Column.run(is_report) select = Column.select(is_report) boolean = Column.boolean(is_report) link = Column.link(cell__format="Yadahada name") number = Column.number()
class TestTable(Table): class Meta: attrs = { 'class': 'listview', 'id': 'table_id', } foo = Column() bar = Column.number() icon = Column.icon('history', is_report, group="group") edit = Column.edit(is_report, group="group") delete = Column.delete(is_report)
def list(request, model, title): return render_table_to_response( request=request, table__model=model, table__column__name__cell__url=lambda row, **_: f'{row.pk}/', table__extra_fields=[ Column.edit(after=0, cell__url=lambda row, **_: f'{row.pk}/edit/'), Column.delete(after=0, cell__url=lambda row, **_: f'{row.pk}/delete/'), ], template='wiki/list.html', context=dict(title=evaluate(title, model=model), ), links=[ Link(f'Create {model._meta.verbose_name}', attrs__href='create/') ])