mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Fixes #11209 - Do not add available ips when IPAddressTable sort preferences are saved * Refine check to account scenario right after clearing ordering string * Introduce get_table_ordering() utility to determine intended ordering given a request * Apply fix to VLAN ranges as well --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,8 +1,24 @@
|
||||
__all__ = (
|
||||
'get_table_ordering',
|
||||
'linkify_phone',
|
||||
)
|
||||
|
||||
|
||||
def get_table_ordering(request, table):
|
||||
"""
|
||||
Given a request, return the prescribed table ordering, if any. This may be necessary to determine prior to rendering
|
||||
the table itself.
|
||||
"""
|
||||
# Check for an explicit ordering
|
||||
if 'sort' in request.GET:
|
||||
return request.GET['sort'] or None
|
||||
|
||||
# Check for a configured preference
|
||||
if request.user.is_authenticated:
|
||||
if preference := request.user.config.get(f'tables.{table.__name__}.ordering'):
|
||||
return preference
|
||||
|
||||
|
||||
def linkify_phone(value):
|
||||
"""
|
||||
Render a telephone number as a hyperlink.
|
||||
|
||||
Reference in New Issue
Block a user