mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Implement support for nested TenantGroups
This commit is contained in:
@ -16,16 +16,32 @@ from .models import Tenant, TenantGroup
|
||||
#
|
||||
|
||||
class TenantGroupForm(BootstrapMixin, forms.ModelForm):
|
||||
parent = DynamicModelChoiceField(
|
||||
queryset=TenantGroup.objects.all(),
|
||||
required=False,
|
||||
widget=APISelect(
|
||||
api_url="/api/tenancy/tenant-groups/"
|
||||
)
|
||||
)
|
||||
slug = SlugField()
|
||||
|
||||
class Meta:
|
||||
model = TenantGroup
|
||||
fields = [
|
||||
'name', 'slug',
|
||||
'parent', 'name', 'slug',
|
||||
]
|
||||
|
||||
|
||||
class TenantGroupCSVForm(forms.ModelForm):
|
||||
parent = forms.ModelChoiceField(
|
||||
queryset=TenantGroup.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Name of parent tenant group',
|
||||
error_messages={
|
||||
'invalid_choice': 'Tenant group not found.',
|
||||
}
|
||||
)
|
||||
slug = SlugField()
|
||||
|
||||
class Meta:
|
||||
|
Reference in New Issue
Block a user