mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
#10094 fix Contact AddAnother
This commit is contained in:
parent
646272f9b3
commit
9fddd193b9
@ -327,6 +327,9 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView):
|
||||
"""
|
||||
return obj
|
||||
|
||||
def get_extra_addanother_params(self, request, params: dict):
|
||||
return params
|
||||
|
||||
#
|
||||
# Request handlers
|
||||
#
|
||||
@ -399,6 +402,7 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView):
|
||||
|
||||
# If cloning is supported, pre-populate a new instance of the form
|
||||
params = prepare_cloned_fields(obj)
|
||||
params = self.get_extra_addanother_params(request, params)
|
||||
if params:
|
||||
if 'return_url' in request.GET:
|
||||
params['return_url'] = request.GET.get('return_url')
|
||||
|
@ -1,4 +1,5 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.http import QueryDict
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from circuits.models import Circuit
|
||||
@ -365,6 +366,15 @@ class ContactAssignmentEditView(generic.ObjectEditView):
|
||||
instance.object = get_object_or_404(content_type.model_class(), pk=request.GET.get('object_id'))
|
||||
return instance
|
||||
|
||||
def get_extra_addanother_params(self, request, params: dict):
|
||||
if not params:
|
||||
params = QueryDict(mutable=True)
|
||||
|
||||
params['content_type'] = request.GET.get('content_type')
|
||||
params['object_id'] = request.GET.get('object_id')
|
||||
|
||||
return params
|
||||
|
||||
|
||||
class ContactAssignmentDeleteView(generic.ObjectDeleteView):
|
||||
queryset = ContactAssignment.objects.all()
|
||||
|
Loading…
Reference in New Issue
Block a user