mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Refactor CompanyDelete view
This commit is contained in:
parent
07910766b3
commit
298d870b44
@ -126,10 +126,10 @@
|
||||
|
||||
|
||||
$('#company-delete').click(function() {
|
||||
launchModalForm(
|
||||
"{% url 'company-delete' company.id %}",
|
||||
{
|
||||
redirect: "{% url 'company-index' %}"
|
||||
constructForm('{% url "api-company-detail" company.pk %}', {
|
||||
method: 'DELETE',
|
||||
title: '{% trans "Delete Company" %}',
|
||||
redirect: '{% url "company-index" %}',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
{% extends "modal_delete_form.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block pre_form_content %}
|
||||
|
||||
{% blocktrans with company.name as name %}Are you sure you want to delete company '{{ name }}'?{% endblocktrans %}
|
||||
|
||||
<br>
|
||||
|
||||
{% if company.supplied_part_count > 0 %}
|
||||
<p>{% blocktrans with company.supplied_part_count as count %}There are {{ count }} parts sourced from this company.<br>
|
||||
If this supplier is deleted, these supplier part entries will also be deleted.{% endblocktrans %}</p>
|
||||
<ul class='list-group'>
|
||||
{% for part in company.parts.all %}
|
||||
<li class='list-group-item'><b>{{ part.SKU }}</b> - <i>{{ part.part.full_name }}</i></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@ -8,8 +8,6 @@ from . import views
|
||||
|
||||
|
||||
company_detail_urls = [
|
||||
url(r'delete/?', views.CompanyDelete.as_view(), name='company-delete'),
|
||||
|
||||
# url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'),
|
||||
|
||||
url(r'^supplier-parts/', views.CompanyDetail.as_view(template_name='company/detail_supplier_part.html'), name='company-detail-supplier-parts'),
|
||||
|
@ -228,22 +228,6 @@ class CompanyImageDownloadFromURL(AjaxUpdateView):
|
||||
)
|
||||
|
||||
|
||||
class CompanyDelete(AjaxDeleteView):
|
||||
""" View for deleting a Company object """
|
||||
|
||||
model = Company
|
||||
success_url = '/company/'
|
||||
ajax_template_name = 'company/delete.html'
|
||||
ajax_form_title = _('Delete Company')
|
||||
context_object_name = 'company'
|
||||
permission_required = 'company.delete_company'
|
||||
|
||||
def get_data(self):
|
||||
return {
|
||||
'danger': _('Company was deleted'),
|
||||
}
|
||||
|
||||
|
||||
class ManufacturerPartDetail(DetailView):
|
||||
""" Detail view for ManufacturerPart """
|
||||
model = ManufacturerPart
|
||||
|
Loading…
Reference in New Issue
Block a user