From adc00650c74b5e657099e64141e7afaf024f83a3 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Sat, 21 Jan 2023 15:10:28 +0530 Subject: [PATCH] added extra add another param --- netbox_acls/views.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/netbox_acls/views.py b/netbox_acls/views.py index 4010a09..19a0204 100644 --- a/netbox_acls/views.py +++ b/netbox_acls/views.py @@ -136,6 +136,16 @@ class ACLInterfaceAssignmentEditView(generic.ObjectEditView): form = forms.ACLInterfaceAssignmentForm template_name = "netbox_acls/aclinterfaceassignment_edit.html" + def get_extra_addanother_params(self, request): + """ + Returns a dictionary of additional parameters to be passed to the "Add Another" button. + """ + + return { + "access_list": request.GET.get("access_list") or request.POST.get("access_list"), + "direction": request.GET.get("direction") or request.POST.get("direction"), + } + class ACLInterfaceAssignmentDeleteView(generic.ObjectDeleteView): """ @@ -183,6 +193,15 @@ class ACLStandardRuleEditView(generic.ObjectEditView): queryset = models.ACLStandardRule.objects.all() form = forms.ACLStandardRuleForm + def get_extra_addanother_params(self, request): + """ + Returns a dictionary of additional parameters to be passed to the "Add Another" button. + """ + + return { + "access_list": request.GET.get("access_list") or request.POST.get("access_list"), + } + class ACLStandardRuleDeleteView(generic.ObjectDeleteView): """ @@ -230,6 +249,15 @@ class ACLExtendedRuleEditView(generic.ObjectEditView): queryset = models.ACLExtendedRule.objects.all() form = forms.ACLExtendedRuleForm + def get_extra_addanother_params(self, request): + """ + Returns a dictionary of additional parameters to be passed to the "Add Another" button. + """ + + return { + "access_list": request.GET.get("access_list") or request.POST.get("access_list"), + } + class ACLExtendedRuleDeleteView(generic.ObjectDeleteView): """