mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 19:48:45 -06:00
Merge branch 'develop' into feature
This commit is contained in:
@@ -2,6 +2,7 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from netbox.forms import NetBoxModelFilterSetForm
|
||||
from tenancy.models import *
|
||||
from tenancy.forms import ContactModelFilterForm
|
||||
from utilities.forms import DynamicModelMultipleChoiceField, TagFilterField
|
||||
|
||||
__all__ = (
|
||||
@@ -27,8 +28,12 @@ class TenantGroupFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class TenantFilterForm(NetBoxModelFilterSetForm):
|
||||
class TenantFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Tenant
|
||||
fieldsets = (
|
||||
(None, ('q', 'tag', 'group_id')),
|
||||
('Contacts', ('contact', 'contact_role'))
|
||||
)
|
||||
group_id = DynamicModelMultipleChoiceField(
|
||||
queryset=TenantGroup.objects.all(),
|
||||
required=False,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
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__ = (
|
||||
'ContactModelFilterForm',
|
||||
'TenancyForm',
|
||||
'TenancyFilterForm',
|
||||
)
|
||||
@@ -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