mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #8645; Allow filtering on core models in the UI
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
from django import forms
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from tenancy.models import Tenant, TenantGroup
|
||||
from tenancy.models import *
|
||||
from utilities.forms import DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
|
||||
__all__ = (
|
||||
'TenancyForm',
|
||||
'TenancyFilterForm',
|
||||
'ContactModelFilterForm'
|
||||
)
|
||||
|
||||
|
||||
@ -44,3 +45,16 @@ class TenancyFilterForm(forms.Form):
|
||||
},
|
||||
label=_('Tenant')
|
||||
)
|
||||
|
||||
|
||||
class ContactModelFilterForm(forms.Form):
|
||||
contact = DynamicModelMultipleChoiceField(
|
||||
queryset=Contact.objects.all(),
|
||||
required=False,
|
||||
label=_('Contact')
|
||||
)
|
||||
contact_role = DynamicModelMultipleChoiceField(
|
||||
queryset=ContactRole.objects.all(),
|
||||
required=False,
|
||||
label=_('Contact Role')
|
||||
)
|
Reference in New Issue
Block a user