Pass object data back to modal when creating new object

This commit is contained in:
Oliver Walters 2019-05-14 23:04:00 +10:00
parent 21c238e96a
commit a316681ec8
2 changed files with 3 additions and 0 deletions

View File

@ -245,6 +245,7 @@ class AjaxCreateView(AjaxMixin, CreateView):
# Return the PK of the newly-created object
data['pk'] = obj.pk
data['text'] = str(obj)
try:
data['url'] = obj.get_absolute_url()

View File

@ -202,6 +202,7 @@ class PartDuplicate(AjaxCreateView):
part = form.save()
data['pk'] = part.pk
data['text'] = str(part)
deep_copy = str2bool(request.POST.get('deep_copy', False))
@ -321,6 +322,7 @@ class PartCreate(AjaxCreateView):
part = form.save()
data['pk'] = part.pk
data['text'] = str(part)
try:
data['url'] = part.get_absolute_url()