class DT(Datatable): my_column = TextColumn('Data', sources=['name', 'get_absolute_url']) class Meta: model = ExampleModel columns = ['my_column']
class DT(Datatable): related = TextColumn('Related', ['related__name']) class Meta: model = ExampleModel columns = ['related'] search_fields = ['name']
class DT(Datatable): name = TextColumn('Name', sources=['name']) class Meta: model = ExampleModel columns = ['name'] ordering = ['pk']
class DT(Datatable): my_column = TextColumn('Data', sources=['date_created', 'name', 'pk']) class Meta: model = ExampleModel columns = ['my_column']
class DT(Datatable): related = TextColumn("Related", ["related__name"]) class Meta: model = ExampleModel columns = ["related"] search_fields = ["name"]
class DT(Datatable): name = TextColumn("Name", sources=["name"]) class Meta: model = ExampleModel columns = ["name"] ordering = ["pk"]
class DT(Datatable): my_column = TextColumn('Data', sources=['get_absolute_url', 'name'], processor='get_data') class Meta: model = ExampleModel columns = ['my_column'] def get_data(self, obj, **kwargs): # Return data that would make the sort order wrong if it were consulted for sorting return obj.pk # tracks with get_absolute_url
class DT(Datatable): my_column = TextColumn( "Data", sources=["get_absolute_url", "name"], processor="get_data" ) class Meta: model = ExampleModel columns = ["my_column"] def get_data(self, obj, **kwargs): # Return data that would make the sort order wrong if it were consulted for sorting return obj.pk # tracks with get_absolute_url
class DT(Datatable): fake = TextColumn('Fake', sources=['get_absolute_url']) class Meta: model = ExampleModel columns = ['name', 'fake']
class DT(Datatable): pk = TextColumn('Data', sources=['get_negative_pk']) class Meta: model = ExampleModel columns = ['pk']
class DT(Datatable): fake = TextColumn("Fake", sources=["get_absolute_url"]) class Meta: model = ExampleModel columns = ["name", "fake"]
class DT(Datatable): pk = TextColumn("Data", sources=["get_negative_pk"]) class Meta: model = ExampleModel columns = ["pk"]
class DT(Datatable): my_column = TextColumn("Data", sources=["name", "get_absolute_url"]) class Meta: model = ExampleModel columns = ["my_column"]
class DT(Datatable): my_column = TextColumn("Data", sources=["date_created", "name", "pk"]) class Meta: model = ExampleModel columns = ["my_column"]