Просмотр исходного кода

Fixes #10408: Fix validation when attempting to add redundant contact assignments

jeremystretch 3 лет назад
Родитель
Сommit
2d9852d6f1

+ 1 - 0
docs/release-notes/version-3.3.md

@@ -9,6 +9,7 @@
 ### Bug Fixes
 
 * [#9497](https://github.com/netbox-community/netbox/issues/9497) - Adjust non-racked device filter on site and location detailed view
+* [#10408](https://github.com/netbox-community/netbox/issues/10408) - Fix validation when attempting to add redundant contact assignments
 * [#10435](https://github.com/netbox-community/netbox/issues/10435) - Fix exception when filtering VLANs by virtual machine with no cluster assigned
 * [#10439](https://github.com/netbox-community/netbox/issues/10439) - Fix form widget styling for DeviceType airflow field
 * [#10445](https://github.com/netbox-community/netbox/issues/10445) - Avoid rounding virtual machine memory values

+ 3 - 0
netbox/templates/tenancy/contactassignment_edit.html

@@ -3,6 +3,9 @@
 {% load form_helpers %}
 
 {% block form %}
+  {% for field in form.hidden_fields %}
+    {{ field }}
+  {% endfor %}
   <div class="field-group my-5">
     <div class="row mb-2">
       <h5 class="offset-sm-3">Contact Assignment</h5>

+ 3 - 1
netbox/tenancy/forms/models.py

@@ -119,8 +119,10 @@ class ContactAssignmentForm(BootstrapMixin, forms.ModelForm):
     class Meta:
         model = ContactAssignment
         fields = (
-            'group', 'contact', 'role', 'priority',
+            'content_type', 'object_id', 'group', 'contact', 'role', 'priority',
         )
         widgets = {
+            'content_type': forms.HiddenInput(),
+            'object_id': forms.HiddenInput(),
             'priority': StaticSelect(),
         }