17476 update remove GFK from fields

This commit is contained in:
Arthur Hanson 2024-10-08 07:44:36 -07:00
parent 3299a761f0
commit 90da31e335
3 changed files with 19 additions and 19 deletions

View File

@ -192,7 +192,7 @@ class EventRuleImportForm(NetBoxModelImportForm):
label=_('Event types'),
help_text=_('The event type(s) which will trigger this rule')
)
action_object_key = forms.CharField(
action_object = forms.CharField(
label=_('Action object'),
required=True,
help_text=_('Webhook name or script as dotted path module.Class')
@ -202,13 +202,13 @@ class EventRuleImportForm(NetBoxModelImportForm):
model = EventRule
fields = (
'name', 'description', 'enabled', 'conditions', 'object_types', 'event_types', 'action_type',
'action_object_key', 'comments', 'tags'
'comments', 'tags'
)
def clean(self):
super().clean()
action_object = self.cleaned_data.get('action_object_key')
action_object = self.cleaned_data.get('action_object')
action_type = self.cleaned_data.get('action_type')
if action_object and action_type:
# Webhook

View File

@ -574,7 +574,7 @@ class VLANGroupForm(NetBoxModelForm):
required=False,
label=_('Scope type')
)
scope_key = DynamicModelChoiceField(
scope = DynamicModelChoiceField(
label=_('Scope'),
queryset=Site.objects.none(), # Initial queryset
required=False,
@ -585,13 +585,13 @@ class VLANGroupForm(NetBoxModelForm):
fieldsets = (
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
FieldSet('vid_ranges', name=_('Child VLANs')),
FieldSet('scope_type', 'scope_key', name=_('Scope')),
FieldSet('scope_type', name=_('Scope')),
)
class Meta:
model = VLANGroup
fields = [
'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'scope_key', 'tags',
'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'tags',
]
def __init__(self, *args, **kwargs):
@ -599,7 +599,7 @@ class VLANGroupForm(NetBoxModelForm):
initial = kwargs.get('initial', {})
if instance is not None and instance.scope:
initial['scope_key'] = instance.scope
initial['scope'] = instance.scope
kwargs['initial'] = initial
super().__init__(*args, **kwargs)
@ -608,15 +608,15 @@ class VLANGroupForm(NetBoxModelForm):
try:
scope_type = ContentType.objects.get(pk=scope_type_id)
model = scope_type.model_class()
self.fields['scope_key'].queryset = model.objects.all()
self.fields['scope_key'].widget.attrs['selector'] = model._meta.label_lower
self.fields['scope_key'].disabled = False
self.fields['scope_key'].label = _(bettertitle(model._meta.verbose_name))
self.fields['scope'].queryset = model.objects.all()
self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower
self.fields['scope'].disabled = False
self.fields['scope'].label = _(bettertitle(model._meta.verbose_name))
except ObjectDoesNotExist:
pass
if self.instance and scope_type_id != self.instance.scope_type_id:
self.initial['scope_key'] = None
self.initial['scope'] = None
def clean(self):
super().clean()

View File

@ -235,7 +235,7 @@ class TunnelTerminationForm(NetBoxModelForm):
selector=True,
label=_('Device')
)
termination_key = DynamicModelChoiceField(
termination = DynamicModelChoiceField(
queryset=Interface.objects.all(),
label=_('Tunnel interface'),
query_params={
@ -252,13 +252,13 @@ class TunnelTerminationForm(NetBoxModelForm):
)
fieldsets = (
FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key', 'outside_ip', 'tags'),
FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key' 'outside_ip', 'tags'),
)
class Meta:
model = TunnelTermination
fields = [
'tunnel', 'role', 'termination_key', 'outside_ip', 'tags',
'tunnel', 'role', 'outside_ip', 'tags',
]
def __init__(self, *args, initial=None, **kwargs):
@ -273,8 +273,8 @@ class TunnelTerminationForm(NetBoxModelForm):
self.fields['parent'].label = _('Virtual Machine')
self.fields['parent'].queryset = VirtualMachine.objects.all()
self.fields['parent'].widget.attrs['selector'] = 'virtualization.virtualmachine'
self.fields['termination_key'].queryset = VMInterface.objects.all()
self.fields['termination_key'].widget.add_query_params({
self.fields['termination'].queryset = VMInterface.objects.all()
self.fields['termination'].widget.add_query_params({
'virtual_machine_id': '$parent',
})
self.fields['outside_ip'].widget.add_query_params({
@ -283,13 +283,13 @@ class TunnelTerminationForm(NetBoxModelForm):
if self.instance.pk:
self.fields['parent'].initial = self.instance.termination.parent_object
self.fields['termination_key'].initial = self.instance.termination
self.fields['termination'].initial = self.instance.termination
def clean(self):
super().clean()
# Set the terminated object
self.instance.termination = self.cleaned_data.get('termination_key')
self.instance.termination = self.cleaned_data.get('termination')
class IKEProposalForm(NetBoxModelForm):