mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-23 20:12:42 -06:00
Add owner field to all applicable filterset forms
This commit is contained in:
@@ -9,7 +9,7 @@ from circuits.models import *
|
|||||||
from dcim.models import Location, Region, Site, SiteGroup
|
from dcim.models import Location, Region, Site, SiteGroup
|
||||||
from ipam.models import ASN
|
from ipam.models import ASN
|
||||||
from netbox.choices import DistanceUnitChoices
|
from netbox.choices import DistanceUnitChoices
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from tenancy.forms import TenancyFilterForm, ContactModelFilterForm
|
from tenancy.forms import TenancyFilterForm, ContactModelFilterForm
|
||||||
from utilities.forms import add_blank_choice
|
from utilities.forms import add_blank_choice
|
||||||
from utilities.forms.fields import ColorField, DynamicModelMultipleChoiceField, TagFilterField
|
from utilities.forms.fields import ColorField, DynamicModelMultipleChoiceField, TagFilterField
|
||||||
@@ -31,7 +31,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ProviderFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class ProviderFilterForm(ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Provider
|
model = Provider
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -66,7 +66,7 @@ class ProviderFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ProviderAccountFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class ProviderAccountFilterForm(ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = ProviderAccount
|
model = ProviderAccount
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -85,7 +85,7 @@ class ProviderAccountFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkFilterForm(NetBoxModelFilterSetForm):
|
class ProviderNetworkFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = ProviderNetwork
|
model = ProviderNetwork
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -104,7 +104,7 @@ class ProviderNetworkFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class CircuitTypeFilterForm(NetBoxModelFilterSetForm):
|
class CircuitTypeFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = CircuitType
|
model = CircuitType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -118,7 +118,7 @@ class CircuitTypeFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -271,7 +271,7 @@ class CircuitTerminationFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class CircuitGroupFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class CircuitGroupFilterForm(TenancyFilterForm, OrganizationalModelFilterSetForm):
|
||||||
model = CircuitGroup
|
model = CircuitGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -309,7 +309,7 @@ class CircuitGroupAssignmentFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class VirtualCircuitTypeFilterForm(NetBoxModelFilterSetForm):
|
class VirtualCircuitTypeFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = VirtualCircuitType
|
model = VirtualCircuitType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -323,7 +323,7 @@ class VirtualCircuitTypeFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VirtualCircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class VirtualCircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = VirtualCircuit
|
model = VirtualCircuit
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
|
|
||||||
from core.choices import *
|
from core.choices import *
|
||||||
from core.models import *
|
from core.models import *
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from netbox.forms.mixins import SavedFiltersMixin
|
from netbox.forms.mixins import SavedFiltersMixin
|
||||||
from netbox.utils import get_data_backend_choices
|
from netbox.utils import get_data_backend_choices
|
||||||
from users.models import User
|
from users.models import User
|
||||||
@@ -23,7 +23,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DataSourceFilterForm(NetBoxModelFilterSetForm):
|
class DataSourceFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = DataSource
|
model = DataSource
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ from extras.forms import LocalConfigContextFilterForm
|
|||||||
from extras.models import ConfigTemplate
|
from extras.models import ConfigTemplate
|
||||||
from ipam.models import ASN, VRF, VLANTranslationPolicy
|
from ipam.models import ASN, VRF, VLANTranslationPolicy
|
||||||
from netbox.choices import *
|
from netbox.choices import *
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import (
|
||||||
|
NestedGroupModelFilterSetForm, NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm,
|
||||||
|
PrimaryModelFilterSetForm,
|
||||||
|
)
|
||||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
||||||
@@ -139,7 +142,7 @@ class DeviceComponentFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RegionFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class RegionFilterForm(ContactModelFilterForm, NestedGroupModelFilterSetForm):
|
||||||
model = Region
|
model = Region
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -154,7 +157,7 @@ class RegionFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class SiteGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class SiteGroupFilterForm(ContactModelFilterForm, NestedGroupModelFilterSetForm):
|
||||||
model = SiteGroup
|
model = SiteGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -169,7 +172,7 @@ class SiteGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class SiteFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class SiteFilterForm(TenancyFilterForm, ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Site
|
model = Site
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -201,7 +204,7 @@ class SiteFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NestedGroupModelFilterSetForm):
|
||||||
model = Location
|
model = Location
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -249,7 +252,7 @@ class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelF
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class RackRoleFilterForm(NetBoxModelFilterSetForm):
|
class RackRoleFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = RackRole
|
model = RackRole
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -257,7 +260,7 @@ class RackRoleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class RackBaseFilterForm(NetBoxModelFilterSetForm):
|
class RackBaseFilterForm(PrimaryModelFilterSetForm):
|
||||||
form_factor = forms.MultipleChoiceField(
|
form_factor = forms.MultipleChoiceField(
|
||||||
label=_('Form factor'),
|
label=_('Form factor'),
|
||||||
choices=RackFormFactorChoices,
|
choices=RackFormFactorChoices,
|
||||||
@@ -418,7 +421,7 @@ class RackElevationFilterForm(RackFilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class RackReservationFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = RackReservation
|
model = RackReservation
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -476,7 +479,7 @@ class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ManufacturerFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class ManufacturerFilterForm(ContactModelFilterForm, OrganizationalModelFilterSetForm):
|
||||||
model = Manufacturer
|
model = Manufacturer
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -485,7 +488,7 @@ class ManufacturerFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class DeviceTypeFilterForm(NetBoxModelFilterSetForm):
|
class DeviceTypeFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = DeviceType
|
model = DeviceType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -613,7 +616,7 @@ class DeviceTypeFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ModuleTypeProfileFilterForm(NetBoxModelFilterSetForm):
|
class ModuleTypeProfileFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = ModuleTypeProfile
|
model = ModuleTypeProfile
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -621,7 +624,7 @@ class ModuleTypeProfileFilterForm(NetBoxModelFilterSetForm):
|
|||||||
selector_fields = ('filter_id', 'q')
|
selector_fields = ('filter_id', 'q')
|
||||||
|
|
||||||
|
|
||||||
class ModuleTypeFilterForm(NetBoxModelFilterSetForm):
|
class ModuleTypeFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = ModuleType
|
model = ModuleType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -706,7 +709,7 @@ class ModuleTypeFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DeviceRoleFilterForm(NetBoxModelFilterSetForm):
|
class DeviceRoleFilterForm(NestedGroupModelFilterSetForm):
|
||||||
model = DeviceRole
|
model = DeviceRole
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -725,7 +728,7 @@ class DeviceRoleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class PlatformFilterForm(NetBoxModelFilterSetForm):
|
class PlatformFilterForm(NestedGroupModelFilterSetForm):
|
||||||
model = Platform
|
model = Platform
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -754,7 +757,7 @@ class DeviceFilterForm(
|
|||||||
LocalConfigContextFilterForm,
|
LocalConfigContextFilterForm,
|
||||||
TenancyFilterForm,
|
TenancyFilterForm,
|
||||||
ContactModelFilterForm,
|
ContactModelFilterForm,
|
||||||
NetBoxModelFilterSetForm
|
PrimaryModelFilterSetForm
|
||||||
):
|
):
|
||||||
model = Device
|
model = Device
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@@ -948,10 +951,7 @@ class DeviceFilterForm(
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class VirtualDeviceContextFilterForm(
|
class VirtualDeviceContextFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
TenancyFilterForm,
|
|
||||||
NetBoxModelFilterSetForm
|
|
||||||
):
|
|
||||||
model = VirtualDeviceContext
|
model = VirtualDeviceContext
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -978,7 +978,7 @@ class VirtualDeviceContextFilterForm(
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Module
|
model = Module
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1061,7 +1061,7 @@ class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, NetBoxMo
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class VirtualChassisFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class VirtualChassisFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = VirtualChassis
|
model = VirtualChassis
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1090,7 +1090,7 @@ class VirtualChassisFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class CableFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class CableFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Cable
|
model = Cable
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1174,7 +1174,7 @@ class CableFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class PowerPanelFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class PowerPanelFilterForm(ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = PowerPanel
|
model = PowerPanel
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1213,7 +1213,7 @@ class PowerPanelFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class PowerFeedFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class PowerFeedFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = PowerFeed
|
model = PowerFeed
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1676,7 +1676,7 @@ class InventoryItemFilterForm(DeviceComponentFilterForm):
|
|||||||
# Device component roles
|
# Device component roles
|
||||||
#
|
#
|
||||||
|
|
||||||
class InventoryItemRoleFilterForm(NetBoxModelFilterSetForm):
|
class InventoryItemRoleFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = InventoryItemRole
|
model = InventoryItemRole
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -1688,7 +1688,7 @@ class InventoryItemRoleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
# Addressing
|
# Addressing
|
||||||
#
|
#
|
||||||
|
|
||||||
class MACAddressFilterForm(NetBoxModelFilterSetForm):
|
class MACAddressFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = MACAddress
|
model = MACAddress
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ from dcim.models import DeviceRole, DeviceType, Location, Platform, Region, Site
|
|||||||
from extras.choices import *
|
from extras.choices import *
|
||||||
from extras.models import *
|
from extras.models import *
|
||||||
from netbox.events import get_event_type_choices
|
from netbox.events import get_event_type_choices
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from netbox.forms.mixins import SavedFiltersMixin
|
from netbox.forms.mixins import OwnerMixin, SavedFiltersMixin
|
||||||
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.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
||||||
@@ -38,7 +38,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldFilterForm(SavedFiltersMixin, FilterForm):
|
class CustomFieldFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = CustomField
|
model = CustomField
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id'),
|
FieldSet('q', 'filter_id'),
|
||||||
@@ -117,7 +117,7 @@ class CustomFieldFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldChoiceSetFilterForm(SavedFiltersMixin, FilterForm):
|
class CustomFieldChoiceSetFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id'),
|
FieldSet('q', 'filter_id'),
|
||||||
@@ -132,7 +132,7 @@ class CustomFieldChoiceSetFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomLinkFilterForm(SavedFiltersMixin, FilterForm):
|
class CustomLinkFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = CustomLink
|
model = CustomLink
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id'),
|
FieldSet('q', 'filter_id'),
|
||||||
@@ -163,7 +163,7 @@ class CustomLinkFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExportTemplateFilterForm(SavedFiltersMixin, FilterForm):
|
class ExportTemplateFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = ExportTemplate
|
model = ExportTemplate
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'object_type_id'),
|
FieldSet('q', 'filter_id', 'object_type_id'),
|
||||||
@@ -226,7 +226,7 @@ class ImageAttachmentFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SavedFilterFilterForm(SavedFiltersMixin, FilterForm):
|
class SavedFilterFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = SavedFilter
|
model = SavedFilter
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id'),
|
FieldSet('q', 'filter_id'),
|
||||||
@@ -287,7 +287,7 @@ class TableConfigFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class WebhookFilterForm(NetBoxModelFilterSetForm):
|
class WebhookFilterForm(OwnerMixin, NetBoxModelFilterSetForm):
|
||||||
model = Webhook
|
model = Webhook
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -309,7 +309,7 @@ class WebhookFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class EventRuleFilterForm(NetBoxModelFilterSetForm):
|
class EventRuleFilterForm(OwnerMixin, NetBoxModelFilterSetForm):
|
||||||
model = EventRule
|
model = EventRule
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -340,7 +340,7 @@ class EventRuleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class TagFilterForm(SavedFiltersMixin, FilterForm):
|
class TagFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = Tag
|
model = Tag
|
||||||
content_type_id = ContentTypeMultipleChoiceField(
|
content_type_id = ContentTypeMultipleChoiceField(
|
||||||
queryset=ObjectType.objects.with_feature('tags'),
|
queryset=ObjectType.objects.with_feature('tags'),
|
||||||
@@ -354,7 +354,7 @@ class TagFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConfigContextProfileFilterForm(SavedFiltersMixin, FilterForm):
|
class ConfigContextProfileFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = ConfigContextProfile
|
model = ConfigContextProfile
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id'),
|
FieldSet('q', 'filter_id'),
|
||||||
@@ -375,7 +375,7 @@ class ConfigContextProfileFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConfigContextFilterForm(SavedFiltersMixin, FilterForm):
|
class ConfigContextFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = ConfigContext
|
model = ConfigContext
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag_id'),
|
FieldSet('q', 'filter_id', 'tag_id'),
|
||||||
@@ -471,7 +471,7 @@ class ConfigContextFilterForm(SavedFiltersMixin, FilterForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConfigTemplateFilterForm(SavedFiltersMixin, FilterForm):
|
class ConfigTemplateFilterForm(SavedFiltersMixin, OwnerMixin, FilterForm):
|
||||||
model = ConfigTemplate
|
model = ConfigTemplate
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from dcim.models import Location, Rack, Region, Site, SiteGroup, Device
|
|||||||
from ipam.choices import *
|
from ipam.choices import *
|
||||||
from ipam.constants import *
|
from ipam.constants import *
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||||
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
||||||
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField
|
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField
|
||||||
@@ -42,7 +42,7 @@ IPADDRESS_MASK_LENGTH_CHOICES = add_blank_choice([
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
class VRFFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class VRFFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = VRF
|
model = VRF
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -62,7 +62,7 @@ class VRFFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class RouteTargetFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class RouteTargetFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = RouteTarget
|
model = RouteTarget
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -82,7 +82,7 @@ class RouteTargetFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class RIRFilterForm(NetBoxModelFilterSetForm):
|
class RIRFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = RIR
|
model = RIR
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -98,7 +98,7 @@ class RIRFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class AggregateFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class AggregateFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Aggregate
|
model = Aggregate
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -119,7 +119,7 @@ class AggregateFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModel
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ASNRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class ASNRangeFilterForm(TenancyFilterForm, OrganizationalModelFilterSetForm):
|
||||||
model = ASNRange
|
model = ASNRange
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -142,7 +142,7 @@ class ASNRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ASNFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class ASNFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = ASN
|
model = ASN
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -167,7 +167,7 @@ class ASNFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class RoleFilterForm(NetBoxModelFilterSetForm):
|
class RoleFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = Role
|
model = Role
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -175,7 +175,7 @@ class RoleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class PrefixFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm, ):
|
class PrefixFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Prefix
|
model = Prefix
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -281,7 +281,7 @@ class PrefixFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFil
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IPRangeFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class IPRangeFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = IPRange
|
model = IPRange
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -328,7 +328,7 @@ class IPRangeFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFi
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IPAddressFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class IPAddressFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -406,7 +406,7 @@ class IPAddressFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModel
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class FHRPGroupFilterForm(NetBoxModelFilterSetForm):
|
class FHRPGroupFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = FHRPGroup
|
model = FHRPGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -439,7 +439,7 @@ class FHRPGroupFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class VLANGroupFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class VLANGroupFilterForm(TenancyFilterForm, OrganizationalModelFilterSetForm):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
FieldSet('region', 'site_group', 'site', 'location', 'rack', name=_('Location')),
|
FieldSet('region', 'site_group', 'site', 'location', 'rack', name=_('Location')),
|
||||||
@@ -492,7 +492,7 @@ class VLANGroupFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class VLANTranslationPolicyFilterForm(NetBoxModelFilterSetForm):
|
class VLANTranslationPolicyFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = VLANTranslationPolicy
|
model = VLANTranslationPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -529,7 +529,7 @@ class VLANTranslationRuleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class VLANFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = VLAN
|
model = VLAN
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -601,7 +601,7 @@ class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ServiceTemplateFilterForm(NetBoxModelFilterSetForm):
|
class ServiceTemplateFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = ServiceTemplate
|
model = ServiceTemplate
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ from django.db.models import Q
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from extras.choices import *
|
from extras.choices import *
|
||||||
from users.models import Owner
|
from .mixins import CustomFieldsMixin, OwnerMixin, SavedFiltersMixin
|
||||||
from utilities.forms.fields import DynamicModelMultipleChoiceField
|
|
||||||
from .mixins import CustomFieldsMixin, SavedFiltersMixin
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
'NestedGroupModelFilterSetForm',
|
||||||
'NetBoxModelFilterSetForm',
|
'NetBoxModelFilterSetForm',
|
||||||
|
'OrganizationalModelFilterSetForm',
|
||||||
|
'PrimaryModelFilterSetForm',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -28,11 +29,6 @@ class NetBoxModelFilterSetForm(CustomFieldsMixin, SavedFiltersMixin, forms.Form)
|
|||||||
required=False,
|
required=False,
|
||||||
label=_('Search')
|
label=_('Search')
|
||||||
)
|
)
|
||||||
owner_id = DynamicModelMultipleChoiceField(
|
|
||||||
queryset=Owner.objects.all(),
|
|
||||||
required=False,
|
|
||||||
label=_('Owner'),
|
|
||||||
)
|
|
||||||
|
|
||||||
selector_fields = ('filter_id', 'q')
|
selector_fields = ('filter_id', 'q')
|
||||||
|
|
||||||
@@ -44,3 +40,24 @@ class NetBoxModelFilterSetForm(CustomFieldsMixin, SavedFiltersMixin, forms.Form)
|
|||||||
|
|
||||||
def _get_form_field(self, customfield):
|
def _get_form_field(self, customfield):
|
||||||
return customfield.to_form_field(set_initial=False, enforce_required=False, enforce_visibility=False)
|
return customfield.to_form_field(set_initial=False, enforce_required=False, enforce_visibility=False)
|
||||||
|
|
||||||
|
|
||||||
|
class PrimaryModelFilterSetForm(OwnerMixin, NetBoxModelFilterSetForm):
|
||||||
|
"""
|
||||||
|
FilterSet form for models which inherit from PrimaryModel.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationalModelFilterSetForm(OwnerMixin, NetBoxModelFilterSetForm):
|
||||||
|
"""
|
||||||
|
FilterSet form for models which inherit from OrganizationalModel.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class NestedGroupModelFilterSetForm(OwnerMixin, NetBoxModelFilterSetForm):
|
||||||
|
"""
|
||||||
|
FilterSet form for models which inherit from NestedGroupModel.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ from django import forms
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from core.models import ObjectType
|
from core.models import ObjectType
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import (
|
||||||
|
NestedGroupModelFilterSetForm, NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm,
|
||||||
|
PrimaryModelFilterSetForm,
|
||||||
|
)
|
||||||
from tenancy.choices import *
|
from tenancy.choices import *
|
||||||
from tenancy.models import *
|
from tenancy.models import *
|
||||||
from tenancy.forms import ContactModelFilterForm
|
from tenancy.forms import ContactModelFilterForm
|
||||||
@@ -25,7 +28,7 @@ __all__ = (
|
|||||||
# Tenants
|
# Tenants
|
||||||
#
|
#
|
||||||
|
|
||||||
class TenantGroupFilterForm(NetBoxModelFilterSetForm):
|
class TenantGroupFilterForm(NestedGroupModelFilterSetForm):
|
||||||
model = TenantGroup
|
model = TenantGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -39,7 +42,7 @@ class TenantGroupFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class TenantFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class TenantFilterForm(ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Tenant
|
model = Tenant
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -59,7 +62,7 @@ class TenantFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
# Contacts
|
# Contacts
|
||||||
#
|
#
|
||||||
|
|
||||||
class ContactGroupFilterForm(NetBoxModelFilterSetForm):
|
class ContactGroupFilterForm(NestedGroupModelFilterSetForm):
|
||||||
model = ContactGroup
|
model = ContactGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -73,7 +76,7 @@ class ContactGroupFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ContactRoleFilterForm(NetBoxModelFilterSetForm):
|
class ContactRoleFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = ContactRole
|
model = ContactRole
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -81,7 +84,7 @@ class ContactRoleFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ContactFilterForm(NetBoxModelFilterSetForm):
|
class ContactFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = Contact
|
model = Contact
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from dcim.models import Device, DeviceRole, Location, Platform, Region, Site, Si
|
|||||||
from extras.forms import LocalConfigContextFilterForm
|
from extras.forms import LocalConfigContextFilterForm
|
||||||
from extras.models import ConfigTemplate
|
from extras.models import ConfigTemplate
|
||||||
from ipam.models import VRF, VLANTranslationPolicy
|
from ipam.models import VRF, VLANTranslationPolicy
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||||
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES
|
||||||
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
|
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
|
||||||
@@ -25,7 +25,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ClusterTypeFilterForm(NetBoxModelFilterSetForm):
|
class ClusterTypeFilterForm(OrganizationalModelFilterSetForm):
|
||||||
model = ClusterType
|
model = ClusterType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -33,7 +33,7 @@ class ClusterTypeFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ClusterGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class ClusterGroupFilterForm(ContactModelFilterForm, OrganizationalModelFilterSetForm):
|
||||||
model = ClusterGroup
|
model = ClusterGroup
|
||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@@ -42,7 +42,7 @@ class ClusterGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Cluster
|
model = Cluster
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -100,7 +100,7 @@ class VirtualMachineFilterForm(
|
|||||||
LocalConfigContextFilterForm,
|
LocalConfigContextFilterForm,
|
||||||
TenancyFilterForm,
|
TenancyFilterForm,
|
||||||
ContactModelFilterForm,
|
ContactModelFilterForm,
|
||||||
NetBoxModelFilterSetForm
|
PrimaryModelFilterSetForm
|
||||||
):
|
):
|
||||||
model = VirtualMachine
|
model = VirtualMachine
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
|
|||||||
|
|
||||||
from dcim.models import Device, Region, Site
|
from dcim.models import Device, Region, Site
|
||||||
from ipam.models import RouteTarget, VLAN
|
from ipam.models import RouteTarget, VLAN
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||||
from utilities.forms.fields import (
|
from utilities.forms.fields import (
|
||||||
ContentTypeMultipleChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField,
|
ContentTypeMultipleChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField,
|
||||||
@@ -30,7 +30,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TunnelGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
class TunnelGroupFilterForm(ContactModelFilterForm, OrganizationalModelFilterSetForm):
|
||||||
model = TunnelGroup
|
model = TunnelGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -39,7 +39,7 @@ class TunnelGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class TunnelFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class TunnelFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = Tunnel
|
model = Tunnel
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -94,7 +94,7 @@ class TunnelTerminationFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IKEProposalFilterForm(NetBoxModelFilterSetForm):
|
class IKEProposalFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = IKEProposal
|
model = IKEProposal
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -125,7 +125,7 @@ class IKEProposalFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IKEPolicyFilterForm(NetBoxModelFilterSetForm):
|
class IKEPolicyFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = IKEPolicy
|
model = IKEPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -149,7 +149,7 @@ class IKEPolicyFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IPSecProposalFilterForm(NetBoxModelFilterSetForm):
|
class IPSecProposalFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = IPSecProposal
|
model = IPSecProposal
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -168,7 +168,7 @@ class IPSecProposalFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IPSecPolicyFilterForm(NetBoxModelFilterSetForm):
|
class IPSecPolicyFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = IPSecPolicy
|
model = IPSecPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -187,7 +187,7 @@ class IPSecPolicyFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class IPSecProfileFilterForm(NetBoxModelFilterSetForm):
|
class IPSecProfileFilterForm(PrimaryModelFilterSetForm):
|
||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -211,7 +211,7 @@ class IPSecProfileFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class L2VPNFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
class L2VPNFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = L2VPN
|
model = L2VPN
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from dcim.choices import LinkStatusChoices
|
from dcim.choices import LinkStatusChoices
|
||||||
from dcim.models import Location, Region, Site, SiteGroup
|
from dcim.models import Location, Region, Site, SiteGroup
|
||||||
from netbox.choices import *
|
from netbox.choices import *
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NestedGroupModelFilterSetForm, PrimaryModelFilterSetForm
|
||||||
from tenancy.forms import TenancyFilterForm
|
from tenancy.forms import TenancyFilterForm
|
||||||
from utilities.forms import add_blank_choice
|
from utilities.forms import add_blank_choice
|
||||||
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
|
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
|
||||||
@@ -19,7 +19,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class WirelessLANGroupFilterForm(NetBoxModelFilterSetForm):
|
class WirelessLANGroupFilterForm(NestedGroupModelFilterSetForm):
|
||||||
model = WirelessLANGroup
|
model = WirelessLANGroup
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -33,7 +33,7 @@ class WirelessLANGroupFilterForm(NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class WirelessLANFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = WirelessLAN
|
model = WirelessLAN
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
@@ -99,7 +99,7 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class WirelessLinkFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
class WirelessLinkFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||||
model = WirelessLink
|
model = WirelessLink
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||||
|
|||||||
Reference in New Issue
Block a user