Fix admin template table name and description ordering bug
This commit is contained in:
parent
3eeff7bca2
commit
4196af9b3f
|
@ -235,11 +235,25 @@ class TemplateTable(tables.Table):
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name="Delete schema")
|
verbose_name="Delete schema")
|
||||||
|
|
||||||
_name = tables.Column(verbose_name="Name")
|
name = tables.Column()
|
||||||
_description = tables.Column(verbose_name="Description")
|
description = tables.Column()
|
||||||
|
|
||||||
|
def order_name(self, queryset, is_descending):
|
||||||
|
queryset = Schemas.objects.order_by(
|
||||||
|
("-" if is_descending else "") + "_name"
|
||||||
|
)
|
||||||
|
|
||||||
|
return (queryset, True)
|
||||||
|
|
||||||
|
def order_description(self, queryset, is_descending):
|
||||||
|
queryset = Schemas.objects.order_by(
|
||||||
|
("-" if is_descending else "") + "_description"
|
||||||
|
)
|
||||||
|
|
||||||
|
return (queryset, True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Schemas
|
model = Schemas
|
||||||
template_name = "idhub/custom_table.html"
|
template_name = "idhub/custom_table.html"
|
||||||
fields = ("created_at", "file_schema", "name", "_description",
|
fields = ("created_at", "file_schema", "name", "description",
|
||||||
"view_schema", "delete_schema")
|
"view_schema", "delete_schema")
|
||||||
|
|
Loading…
Reference in New Issue