mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
from django import forms
|
|
|
|
from extras.forms import AddRemoveTagsForm, CustomFieldModelBulkEditForm
|
|
from tenancy.models import Tenant, TenantGroup
|
|
from utilities.forms import BootstrapMixin, DynamicModelChoiceField
|
|
|
|
__all__ = (
|
|
'TenantBulkEditForm',
|
|
'TenantGroupBulkEditForm',
|
|
)
|
|
|
|
|
|
class TenantGroupBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
|
pk = forms.ModelMultipleChoiceField(
|
|
queryset=TenantGroup.objects.all(),
|
|
widget=forms.MultipleHiddenInput
|
|
)
|
|
parent = DynamicModelChoiceField(
|
|
queryset=TenantGroup.objects.all(),
|
|
required=False
|
|
)
|
|
description = forms.CharField(
|
|
max_length=200,
|
|
required=False
|
|
)
|
|
|
|
class Meta:
|
|
nullable_fields = ['parent', 'description']
|
|
|
|
|
|
class TenantBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm):
|
|
pk = forms.ModelMultipleChoiceField(
|
|
queryset=Tenant.objects.all(),
|
|
widget=forms.MultipleHiddenInput()
|
|
)
|
|
group = DynamicModelChoiceField(
|
|
queryset=TenantGroup.objects.all(),
|
|
required=False
|
|
)
|
|
|
|
class Meta:
|
|
nullable_fields = [
|
|
'group',
|
|
]
|