mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Use DynamicModelChoiceField for policy field
This commit is contained in:
parent
de48e2543c
commit
c9eb6cb4bf
@ -126,5 +126,5 @@ class VLANTranslationPolicySerializer(NetBoxModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = VLANTranslationPolicy
|
||||
fields = ('id', 'name', 'description', 'rules')
|
||||
brief_fields = ('id', 'rules')
|
||||
fields = ('id', 'url', 'name', 'description', 'display', 'rules')
|
||||
brief_fields = ('id', 'url', 'name', 'description', 'display')
|
||||
|
@ -144,7 +144,7 @@ class VLANViewSet(NetBoxModelViewSet):
|
||||
|
||||
|
||||
class VLANTranslationPolicyViewSet(NetBoxModelViewSet):
|
||||
queryset = VLANTranslationPolicy.objects.prefetch_related('rules')
|
||||
queryset = VLANTranslationPolicy.objects.all()
|
||||
serializer_class = serializers.VLANTranslationPolicySerializer
|
||||
filterset_class = filtersets.VLANTranslationPolicyFilterSet
|
||||
|
||||
|
@ -707,6 +707,13 @@ class VLANTranslationPolicyForm(NetBoxModelForm):
|
||||
|
||||
|
||||
class VLANTranslationRuleForm(NetBoxModelForm):
|
||||
policy = DynamicModelChoiceField(
|
||||
label=_('Policy'),
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
selector=True
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('policy', 'local_vid', 'remote_vid', name=_('VLAN Translation Rule')),
|
||||
|
@ -1037,7 +1037,7 @@ class VLANTranslationPolicyBulkDeleteView(generic.BulkDeleteView):
|
||||
|
||||
|
||||
#
|
||||
# VLAN Translation Policies
|
||||
# VLAN Translation Rules
|
||||
#
|
||||
|
||||
class VLANTranslationRuleListView(generic.ObjectListView):
|
||||
|
Loading…
Reference in New Issue
Block a user