Delete a part parameter template from the settings view

This commit is contained in:
Oliver Walters 2019-09-07 20:30:51 +10:00
parent 42ade0e0b7
commit c45fcb45cf
3 changed files with 20 additions and 1 deletions

View File

@ -22,7 +22,7 @@ part_parameter_urls = [
url('^template/new/', views.PartParameterTemplateCreate.as_view(), name='part-param-template-create'),
url('^template/(?P<pk>\d+)/edit/', views.PartParameterTemplateEdit.as_view(), name='part-param-template-edit'),
#url('^template/(?P<pk>\d+)/delete/', views.PartParameterTemplateDelete.as_view(), name='part-param-template-edit'),
url('^template/(?P<pk>\d+)/delete/', views.PartParameterTemplateDelete.as_view(), name='part-param-template-edit'),
url('^new/', views.PartParameterCreate.as_view(), name='part-param-create'),
url('^(?P<pk>\d+)/edit/', views.PartParameterEdit.as_view(), name='part-param-edit'),

View File

@ -1454,6 +1454,13 @@ class PartParameterTemplateEdit(AjaxUpdateView):
ajax_form_title = 'Edit Part Parameter Template'
class PartParameterTemplateDelete(AjaxDeleteView):
""" View for deleting an existing PartParameterTemplate """
model = PartParameterTemplate
ajax_form_title = "Delete Part Parameter Template"
class PartParameterCreate(AjaxCreateView):
""" View for creating a new PartParameter """

View File

@ -76,4 +76,16 @@
});
});
$("#param-table").on('click', '.template-delete', function() {
var button = $(this);
var url = "/part/parameter/template/" + button.attr('pk') + "/delete/";
launchModalForm(url, {
success: function() {
$("#param-table").bootstrapTable('refresh');
}
});
});
{% endblock %}