mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 10:16:42 -06:00
12252 allow sorting on object in search (#12357)
* 12252 allow sorting on object in search * 12252 code review changes
This commit is contained in:
parent
d39c796828
commit
9a788349a9
@ -145,9 +145,12 @@ class CachedValueSearchBackend(SearchBackend):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Omit any results pertaining to an object the user does not have permission to view
|
# Omit any results pertaining to an object the user does not have permission to view
|
||||||
return [
|
ret = []
|
||||||
r for r in results if r.object is not None
|
for r in results:
|
||||||
]
|
if r.object is not None:
|
||||||
|
r.name = str(r.object)
|
||||||
|
ret.append(r)
|
||||||
|
return ret
|
||||||
|
|
||||||
def cache(self, instances, indexer=None, remove_existing=True):
|
def cache(self, instances, indexer=None, remove_existing=True):
|
||||||
content_type = None
|
content_type = None
|
||||||
|
@ -204,7 +204,8 @@ class SearchTable(tables.Table):
|
|||||||
order_by="object___meta__verbose_name",
|
order_by="object___meta__verbose_name",
|
||||||
)
|
)
|
||||||
object = tables.Column(
|
object = tables.Column(
|
||||||
linkify=True
|
linkify=True,
|
||||||
|
order_by=('name', )
|
||||||
)
|
)
|
||||||
field = tables.Column()
|
field = tables.Column()
|
||||||
value = tables.Column()
|
value = tables.Column()
|
||||||
|
Loading…
Reference in New Issue
Block a user