1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #10721: Disable ordering by custom object field columns

This commit is contained in:
jeremystretch
2022-11-17 16:30:54 -05:00
parent bd29d15814
commit cf55e96241
2 changed files with 7 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* [#9878](https://github.com/netbox-community/netbox/issues/9878) - Fix spurious error message when rendering REST API docs * [#9878](https://github.com/netbox-community/netbox/issues/9878) - Fix spurious error message when rendering REST API docs
* [#10579](https://github.com/netbox-community/netbox/issues/10579) - Mark cable traces terminating to a provider network as complete * [#10579](https://github.com/netbox-community/netbox/issues/10579) - Mark cable traces terminating to a provider network as complete
* [#10721](https://github.com/netbox-community/netbox/issues/10721) - Disable ordering by custom object field columns
--- ---

View File

@ -425,6 +425,12 @@ class CustomFieldColumn(tables.Column):
kwargs['accessor'] = Accessor(f'custom_field_data__{customfield.name}') kwargs['accessor'] = Accessor(f'custom_field_data__{customfield.name}')
if 'verbose_name' not in kwargs: if 'verbose_name' not in kwargs:
kwargs['verbose_name'] = customfield.label or customfield.name kwargs['verbose_name'] = customfield.label or customfield.name
# We can't logically sort on FK values
if customfield.type in (
CustomFieldTypeChoices.TYPE_OBJECT,
CustomFieldTypeChoices.TYPE_MULTIOBJECT
):
kwargs['orderable'] = False
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)