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

Adds tags on contact assignment (#13328)

* adds tags on contact assignments #12882

* updated migration

* added tags on import form

* adds TagsMixin on ContactAssignmentType #12882

* Misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Abhimanyu Saharan
2023-08-01 21:22:14 +05:30
committed by GitHub
parent c1ca8d5d8d
commit cbf4b43b35
10 changed files with 44 additions and 12 deletions

View File

@ -1,10 +1,11 @@
from django import forms
from django.utils.translation import gettext_lazy as _
from extras.models import Tag
from netbox.forms import NetBoxModelForm
from tenancy.models import *
from utilities.forms import BootstrapMixin
from utilities.forms.fields import CommentField, DynamicModelChoiceField, SlugField
from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField
__all__ = (
'ContactAssignmentForm',
@ -140,11 +141,16 @@ class ContactAssignmentForm(BootstrapMixin, forms.ModelForm):
label=_('Role'),
queryset=ContactRole.objects.all()
)
tags = DynamicModelMultipleChoiceField(
queryset=Tag.objects.all(),
required=False,
label=_('Tags')
)
class Meta:
model = ContactAssignment
fields = (
'content_type', 'object_id', 'group', 'contact', 'role', 'priority',
'content_type', 'object_id', 'group', 'contact', 'role', 'priority', 'tags'
)
widgets = {
'content_type': forms.HiddenInput(),