mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
18981 fix filtersets
This commit is contained in:
parent
ddf580a6e6
commit
fcceae5e1b
@ -59,7 +59,7 @@ MACADDRESS_COPY_BUTTON = """
|
|||||||
#
|
#
|
||||||
|
|
||||||
class DeviceRoleTable(NetBoxTable):
|
class DeviceRoleTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = columns.MPTTColumn(
|
||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,9 @@ from dcim.models import DeviceRole, DeviceType, Location, Platform, Region, Site
|
|||||||
from netbox.filtersets import BaseFilterSet, ChangeLoggedModelFilterSet, NetBoxModelFilterSet
|
from netbox.filtersets import BaseFilterSet, ChangeLoggedModelFilterSet, NetBoxModelFilterSet
|
||||||
from tenancy.models import Tenant, TenantGroup
|
from tenancy.models import Tenant, TenantGroup
|
||||||
from users.models import Group, User
|
from users.models import Group, User
|
||||||
from utilities.filters import ContentTypeFilter, MultiValueCharFilter, MultiValueNumberFilter
|
from utilities.filters import (
|
||||||
|
ContentTypeFilter, MultiValueCharFilter, MultiValueNumberFilter, TreeNodeMultipleChoiceFilter
|
||||||
|
)
|
||||||
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
||||||
from .choices import *
|
from .choices import *
|
||||||
from .filters import TagFilter
|
from .filters import TagFilter
|
||||||
@ -583,14 +585,16 @@ class ConfigContextFilterSet(ChangeLoggedModelFilterSet):
|
|||||||
queryset=DeviceType.objects.all(),
|
queryset=DeviceType.objects.all(),
|
||||||
label=_('Device type'),
|
label=_('Device type'),
|
||||||
)
|
)
|
||||||
device_role_id = django_filters.ModelMultipleChoiceFilter(
|
device_role_id = TreeNodeMultipleChoiceFilter(
|
||||||
field_name='roles',
|
field_name='roles',
|
||||||
|
lookup_expr='in',
|
||||||
queryset=DeviceRole.objects.all(),
|
queryset=DeviceRole.objects.all(),
|
||||||
label=_('Role'),
|
label=_('Role'),
|
||||||
)
|
)
|
||||||
device_role = django_filters.ModelMultipleChoiceFilter(
|
device_role = TreeNodeMultipleChoiceFilter(
|
||||||
field_name='roles__slug',
|
field_name='roles',
|
||||||
queryset=DeviceRole.objects.all(),
|
queryset=DeviceRole.objects.all(),
|
||||||
|
lookup_expr='in',
|
||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
label=_('Role (slug)'),
|
label=_('Role (slug)'),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user