mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#11584: Add bulk edit view & tests
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
from django import forms
|
||||
|
||||
from netbox.forms import NetBoxModelBulkEditForm
|
||||
from tenancy.choices import ContactPriorityChoices
|
||||
from tenancy.models import *
|
||||
from utilities.forms import CommentField, DynamicModelChoiceField
|
||||
from utilities.forms import CommentField, DynamicModelChoiceField, add_blank_choice
|
||||
|
||||
__all__ = (
|
||||
'ContactAssignmentBulkEditForm',
|
||||
'ContactBulkEditForm',
|
||||
'ContactGroupBulkEditForm',
|
||||
'ContactRoleBulkEditForm',
|
||||
@ -114,3 +116,24 @@ class ContactBulkEditForm(NetBoxModelBulkEditForm):
|
||||
(None, ('group', 'title', 'phone', 'email', 'address', 'link', 'description')),
|
||||
)
|
||||
nullable_fields = ('group', 'title', 'phone', 'email', 'address', 'link', 'description', 'comments')
|
||||
|
||||
|
||||
class ContactAssignmentBulkEditForm(NetBoxModelBulkEditForm):
|
||||
contact = DynamicModelChoiceField(
|
||||
queryset=Contact.objects.all(),
|
||||
required=False
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
queryset=ContactRole.objects.all(),
|
||||
required=False
|
||||
)
|
||||
priority = forms.ChoiceField(
|
||||
choices=add_blank_choice(ContactPriorityChoices),
|
||||
required=False
|
||||
)
|
||||
|
||||
model = ContactAssignment
|
||||
fieldsets = (
|
||||
(None, ('contact', 'role', 'priority')),
|
||||
)
|
||||
nullable_fields = ('priority',)
|
||||
|
Reference in New Issue
Block a user