Change form title if part is being copied

This commit is contained in:
Oliver Walters 2019-04-18 23:22:58 +10:00
parent 6de58edd41
commit 05beb26c82

View File

@ -50,7 +50,6 @@ class PartCreate(AjaxCreateView):
""" """
model = Part model = Part
form_class = EditPartForm form_class = EditPartForm
template_name = 'part/create.html'
ajax_form_title = 'Create new part' ajax_form_title = 'Create new part'
ajax_template_name = 'modal_form.html' ajax_template_name = 'modal_form.html'
@ -85,6 +84,7 @@ class PartCreate(AjaxCreateView):
try: try:
original = Part.objects.get(pk=part_to_copy) original = Part.objects.get(pk=part_to_copy)
initials = model_to_dict(original) initials = model_to_dict(original)
self.ajax_form_title = "Copy Part '{p}'".format(p=original.name)
except Part.DoesNotExist: except Part.DoesNotExist:
initials = super(PartCreate, self).get_initial() initials = super(PartCreate, self).get_initial()