mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix filtering for platforms, tenant groups
This commit is contained in:
@ -2025,6 +2025,15 @@ class PlatformBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
|||||||
nullable_fields = ['manufacturer', 'napalm_driver', 'description']
|
nullable_fields = ['manufacturer', 'napalm_driver', 'description']
|
||||||
|
|
||||||
|
|
||||||
|
class PlatformFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||||
|
model = Platform
|
||||||
|
manufacturer_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=Manufacturer.objects.all(),
|
||||||
|
required=False,
|
||||||
|
label=_('Manufacturer')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Devices
|
# Devices
|
||||||
#
|
#
|
||||||
|
@ -1218,6 +1218,8 @@ class PlatformListView(generic.ObjectListView):
|
|||||||
vm_count=count_related(VirtualMachine, 'platform')
|
vm_count=count_related(VirtualMachine, 'platform')
|
||||||
)
|
)
|
||||||
table = tables.PlatformTable
|
table = tables.PlatformTable
|
||||||
|
filterset = filtersets.PlatformFilterSet
|
||||||
|
filterset_form = forms.PlatformFilterForm
|
||||||
|
|
||||||
|
|
||||||
class PlatformView(generic.ObjectView):
|
class PlatformView(generic.ObjectView):
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% if object.manufacturer %}
|
{% if object.manufacturer %}
|
||||||
<li class="breadcrumb-item"><a href="{% url 'dcim:platform_list' %}?manufacturer={{ object.manufacturer.slug }}">{{ object.manufacturer }}</a></li>
|
<li class="breadcrumb-item"><a href="{% url 'dcim:platform_list' %}?manufacturer_id={{ object.manufacturer.pk }}">{{ object.manufacturer }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% for tenantgroup in object.get_ancestors %}
|
{% for tenantgroup in object.get_ancestors %}
|
||||||
<li class="breadcrumb-item"><a href="{% url 'tenancy:tenantgroup_list' %}?parent={{ tenantgroup.slug }}">{{ tenantgroup }}</a></li>
|
<li class="breadcrumb-item"><a href="{% url 'tenancy:tenantgroup_list' %}?parent_id={{ tenantgroup.pk }}">{{ tenantgroup }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -62,6 +62,15 @@ class TenantGroupBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
|||||||
nullable_fields = ['parent', 'description']
|
nullable_fields = ['parent', 'description']
|
||||||
|
|
||||||
|
|
||||||
|
class TenantGroupFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||||
|
model = TenantGroup
|
||||||
|
parent_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=TenantGroup.objects.all(),
|
||||||
|
required=False,
|
||||||
|
label=_('Parent group')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tenants
|
# Tenants
|
||||||
#
|
#
|
||||||
|
@ -20,6 +20,8 @@ class TenantGroupListView(generic.ObjectListView):
|
|||||||
'tenant_count',
|
'tenant_count',
|
||||||
cumulative=True
|
cumulative=True
|
||||||
)
|
)
|
||||||
|
filterset = filtersets.TenantGroupFilterSet
|
||||||
|
filterset_form = forms.TenantGroupFilterForm
|
||||||
table = tables.TenantGroupTable
|
table = tables.TenantGroupTable
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user