diff --git a/netbox/ipam/forms/bulk_edit.py b/netbox/ipam/forms/bulk_edit.py index bf54019b3..49a79623c 100644 --- a/netbox/ipam/forms/bulk_edit.py +++ b/netbox/ipam/forms/bulk_edit.py @@ -554,12 +554,19 @@ class VLANTranslationPolicyBulkEditForm(NetBoxModelBulkEditForm): class VLANTranslationRuleBulkEditForm(NetBoxModelBulkEditForm): + policy = DynamicModelChoiceField( + label=_('Policy'), + queryset=VLANTranslationPolicy.objects.all(), + selector=True + ) + local_vid = forms.IntegerField(required=False) + remote_vid = forms.IntegerField(required=False) model = VLANTranslationRule fieldsets = ( FieldSet('policy', 'local_vid', 'remote_vid'), ) - nullable_fields = ('description',) + fields = ('policy', 'local_vid', 'remote_vid') class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm): diff --git a/netbox/ipam/tests/test_views.py b/netbox/ipam/tests/test_views.py index a4f5a716e..c45777f08 100644 --- a/netbox/ipam/tests/test_views.py +++ b/netbox/ipam/tests/test_views.py @@ -953,8 +953,6 @@ class VLANTranslationRuleTestCase(ViewTestCases.PrimaryObjectViewTestCase): ) VLANTranslationRule.objects.bulk_create(vlan_translation_rules) - tags = create_tags('Alpha', 'Bravo', 'Charlie') - cls.form_data = { 'policy': vlan_translation_policies[0].pk, 'local_vid': 300, @@ -962,38 +960,23 @@ class VLANTranslationRuleTestCase(ViewTestCases.PrimaryObjectViewTestCase): } cls.csv_data = ( - "policy_id,local_vid,remote_vid", + "policy,local_vid,remote_vid", f"{vlan_translation_policies[0].pk},103,203", f"{vlan_translation_policies[0].pk},104,204", f"{vlan_translation_policies[1].pk},105,205", ) cls.csv_update_data = ( - "id,policy_id,local_vid,remote_vid", + "id,policy,local_vid,remote_vid", f"{vlan_translation_rules[0].pk},{vlan_translation_policies[1].pk},105,205", f"{vlan_translation_rules[1].pk},{vlan_translation_policies[1].pk},106,206", f"{vlan_translation_rules[2].pk},{vlan_translation_policies[0].pk},107,207", ) cls.bulk_edit_data = { - 'tags': [t.pk for t in tags], + 'policy': vlan_translation_policies[2].pk, } - # def test_bulk_edit_objects_with_permission(self): - # pass - # - # def test_bulk_edit_objects_with_constrained_permission(self): - # pass - # - # def test_bulk_import_objects_with_permission(self): - # pass - # - # def test_bulk_import_objects_with_constrained_permission(self): - # pass - # - # def test_bulk_update_objects_with_permission(self): - # pass - class ServiceTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase): model = ServiceTemplate