#10094 fix Contact AddAnother

This commit is contained in:
Arthur 2022-08-22 16:31:41 -07:00
parent 646272f9b3
commit 9fddd193b9
2 changed files with 14 additions and 0 deletions

View File

@ -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')

View File

@ -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()