mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 00:36:11 -06:00
changes as per review
This commit is contained in:
parent
c666162666
commit
b710aff306
@ -1273,6 +1273,18 @@ class DeviceComponentFilterSet(django_filters.FilterSet):
|
|||||||
to_field_name='name',
|
to_field_name='name',
|
||||||
label=_('Virtual Chassis'),
|
label=_('Virtual Chassis'),
|
||||||
)
|
)
|
||||||
|
# TODO: Remove in v4.0
|
||||||
|
device_role_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='device__role',
|
||||||
|
queryset=DeviceRole.objects.all(),
|
||||||
|
label=_('Device role (ID)'),
|
||||||
|
)
|
||||||
|
device_role = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='device__role__slug',
|
||||||
|
queryset=DeviceRole.objects.all(),
|
||||||
|
to_field_name='slug',
|
||||||
|
label=_('Device role (slug)'),
|
||||||
|
)
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
|
@ -811,14 +811,14 @@ class Device(PrimaryModel, ConfigContextModel, TrackingModelMixin):
|
|||||||
@property
|
@property
|
||||||
def device_role(self):
|
def device_role(self):
|
||||||
"""
|
"""
|
||||||
For backwards compatibility with pre-v3.5 code expecting a device_role to be present on Device.
|
For backwards compatibility with pre-v3.6 code expecting a device_role to be present on Device.
|
||||||
"""
|
"""
|
||||||
return self.role
|
return self.role
|
||||||
|
|
||||||
@device_role.setter
|
@device_role.setter
|
||||||
def device_role(self, value):
|
def device_role(self, value):
|
||||||
"""
|
"""
|
||||||
For backwards compatibility with pre-v3.5 code expecting a device_role to be present on Device.
|
For backwards compatibility with pre-v3.6 code expecting a device_role to be present on Device.
|
||||||
"""
|
"""
|
||||||
self.role = value
|
self.role = value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user