1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Generic view cleanup

This commit is contained in:
jeremystretch
2021-12-14 11:28:13 -05:00
parent f2f6edabf9
commit 2dad35186a
6 changed files with 102 additions and 51 deletions

View File

@@ -721,7 +721,7 @@ class IPAddressEditView(generic.ObjectEditView):
model_form = forms.IPAddressForm
template_name = 'ipam/ipaddress_edit.html'
def alter_obj(self, obj, request, url_args, url_kwargs):
def alter_object(self, obj, request, url_args, url_kwargs):
if 'interface' in request.GET:
try:
@@ -975,7 +975,7 @@ class FHRPGroupAssignmentEditView(generic.ObjectEditView):
model_form = forms.FHRPGroupAssignmentForm
template_name = 'ipam/fhrpgroupassignment_edit.html'
def alter_obj(self, instance, request, args, kwargs):
def alter_object(self, instance, request, args, kwargs):
if not instance.pk:
# Assign the interface based on URL kwargs
content_type = get_object_or_404(ContentType, pk=request.GET.get('interface_type'))
@@ -1092,7 +1092,7 @@ class ServiceEditView(generic.ObjectEditView):
model_form = forms.ServiceForm
template_name = 'ipam/service_edit.html'
def alter_obj(self, obj, request, url_args, url_kwargs):
def alter_object(self, obj, request, url_args, url_kwargs):
if 'device' in url_kwargs:
obj.device = get_object_or_404(
Device.objects.restrict(request.user),