1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

110 lines
2.3 KiB
Python
Raw Normal View History

2021-09-27 17:19:05 -04:00
from django import forms
from netbox.forms import NetBoxModelBulkEditForm
2021-10-18 11:45:05 -04:00
from tenancy.models import *
2021-11-18 16:48:29 -05:00
from utilities.forms import DynamicModelChoiceField
2021-09-27 17:19:05 -04:00
__all__ = (
2021-10-18 11:45:05 -04:00
'ContactBulkEditForm',
'ContactGroupBulkEditForm',
'ContactRoleBulkEditForm',
2021-09-27 17:19:05 -04:00
'TenantBulkEditForm',
'TenantGroupBulkEditForm',
)
2021-10-18 11:45:05 -04:00
#
# Tenants
#
class TenantGroupBulkEditForm(NetBoxModelBulkEditForm):
2021-09-27 17:19:05 -04:00
parent = DynamicModelChoiceField(
queryset=TenantGroup.objects.all(),
required=False
)
description = forms.CharField(
max_length=200,
required=False
)
model = TenantGroup
nullable_fields = ('parent', 'description')
2021-09-27 17:19:05 -04:00
class TenantBulkEditForm(NetBoxModelBulkEditForm):
2021-09-27 17:19:05 -04:00
group = DynamicModelChoiceField(
queryset=TenantGroup.objects.all(),
required=False
)
model = Tenant
fieldsets = (
(None, ('group',)),
)
nullable_fields = ('group',)
2021-10-18 11:45:05 -04:00
#
# Contacts
#
class ContactGroupBulkEditForm(NetBoxModelBulkEditForm):
2021-10-18 11:45:05 -04:00
parent = DynamicModelChoiceField(
queryset=ContactGroup.objects.all(),
required=False
)
description = forms.CharField(
max_length=200,
required=False
)
model = ContactGroup
fieldsets = (
(None, ('parent', 'description')),
)
nullable_fields = ('parent', 'description')
2021-10-18 11:45:05 -04:00
class ContactRoleBulkEditForm(NetBoxModelBulkEditForm):
2021-10-18 11:45:05 -04:00
description = forms.CharField(
max_length=200,
required=False
)
model = ContactRole
fieldsets = (
(None, ('description',)),
)
nullable_fields = ('description',)
2021-10-18 11:45:05 -04:00
class ContactBulkEditForm(NetBoxModelBulkEditForm):
2021-10-18 11:45:05 -04:00
group = DynamicModelChoiceField(
queryset=ContactGroup.objects.all(),
required=False
)
2021-10-18 16:20:31 -04:00
title = forms.CharField(
max_length=100,
required=False
)
phone = forms.CharField(
max_length=50,
required=False
)
email = forms.EmailField(
required=False
)
address = forms.CharField(
max_length=200,
required=False
)
link = forms.URLField(
required=False
)
2021-10-18 11:45:05 -04:00
model = Contact
fieldsets = (
(None, ('group', 'title', 'phone', 'email', 'address', 'link')),
)
nullable_fields = ('group', 'title', 'phone', 'email', 'address', 'link', 'comments')