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