mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -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
|
||||
return [
|
||||
r for r in results if r.object is not None
|
||||
]
|
||||
ret = []
|
||||
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):
|
||||
content_type = None
|
||||
|
@ -204,7 +204,8 @@ class SearchTable(tables.Table):
|
||||
order_by="object___meta__verbose_name",
|
||||
)
|
||||
object = tables.Column(
|
||||
linkify=True
|
||||
linkify=True,
|
||||
order_by=('name', )
|
||||
)
|
||||
field = tables.Column()
|
||||
value = tables.Column()
|
||||
|
Loading…
Reference in New Issue
Block a user