mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add contact assignments to models
This commit is contained in:
@ -1,11 +1,15 @@
|
||||
from django import forms
|
||||
|
||||
from extras.forms import CustomFieldModelForm
|
||||
from extras.models import Tag
|
||||
from tenancy.models import *
|
||||
from utilities.forms import (
|
||||
BootstrapMixin, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField, SmallTextarea,
|
||||
StaticSelect,
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
'ContactAssignmentForm',
|
||||
'ContactForm',
|
||||
'ContactGroupForm',
|
||||
'ContactRoleForm',
|
||||
@ -100,3 +104,25 @@ class ContactForm(BootstrapMixin, CustomFieldModelForm):
|
||||
widgets = {
|
||||
'address': SmallTextarea(attrs={'rows': 3}),
|
||||
}
|
||||
|
||||
|
||||
class ContactAssignmentForm(BootstrapMixin, forms.ModelForm):
|
||||
group = DynamicModelChoiceField(
|
||||
queryset=ContactGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
contact = DynamicModelChoiceField(
|
||||
queryset=Contact.objects.all()
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
queryset=ContactRole.objects.all()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = ContactAssignment
|
||||
fields = (
|
||||
'group', 'contact', 'role', 'priority',
|
||||
)
|
||||
widgets = {
|
||||
'priority': StaticSelect(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user