diff --git a/assets/static/js/ajax_form.js b/assets/static/js/ajax_form.js deleted file mode 100644 index f4ffcf43..00000000 --- a/assets/static/js/ajax_form.js +++ /dev/null @@ -1,41 +0,0 @@ - - - - -function formAssetSearch() { - $.ajax({ - url : "/asset/filter/", // the endpoint - type : "POST", // http method - data : { - sender: 'asset_update', - form: "csrfmiddlewaretoken=" + $('input[name=csrfmiddlewaretoken]').val() + "&asset_id=" + $('#parent_search').val() - }, - traditional: true, - - success : function(data) { - // console.log(data); - $('#formAssetSearchResult').html(data); - // window.location.href = data['url']; - }, - - error : function(xhr) {console.log(xhr.status + ": " + xhr.responseText)} - }); -} - -function deleteAsset(asset_id) { - $.ajax({ - url : "/asset/delete/", // the endpoint - type : "POST", // http method - data : { - asset_id: asset_id - }, - traditional: true, - - success : function(data) { - // console.log(data); - window.location.href = data['url']; - }, - - error : function(xhr) {console.log(xhr.status + ": " + xhr.responseText)} - }); -} \ No newline at end of file diff --git a/assets/templates/asset_create.html b/assets/templates/asset_create.html index 1e58c720..cb235392 100644 --- a/assets/templates/asset_create.html +++ b/assets/templates/asset_create.html @@ -53,8 +53,6 @@ - {% include 'partials/confirm_delete.html' with object=object %} - {% endblock %} {% block js%} diff --git a/assets/templates/asset_update.html b/assets/templates/asset_update.html index e4cbaa6f..8b734962 100644 --- a/assets/templates/asset_update.html +++ b/assets/templates/asset_update.html @@ -52,8 +52,6 @@ -{% include 'partials/confirm_delete.html' with object=object %} - {% endblock %} {% block js%} diff --git a/assets/templates/partials/asset_buttons.html b/assets/templates/partials/asset_buttons.html index bf302351..4d6507db 100644 --- a/assets/templates/partials/asset_buttons.html +++ b/assets/templates/partials/asset_buttons.html @@ -2,7 +2,6 @@ Duplicate - Delete {% elif duplicate %} @@ -14,7 +13,6 @@
Edit Duplicate - Delete
{% endif %} {% if create or edit or duplicate %} diff --git a/assets/templates/partials/confirm_delete.html b/assets/templates/partials/confirm_delete.html deleted file mode 100644 index c0cb011d..00000000 --- a/assets/templates/partials/confirm_delete.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/assets/urls.py b/assets/urls.py index c7dcf2fc..511bb4a6 100644 --- a/assets/urls.py +++ b/assets/urls.py @@ -14,7 +14,6 @@ urlpatterns = [ path('asset/create/', permission_required_with_403('assets.create_asset')(views.AssetCreate.as_view()), name='asset_create'), path('asset//edit/', permission_required_with_403('assets.change_asset')(views.AssetEdit.as_view()), name='asset_update'), path('asset//duplicate/', permission_required_with_403('assets.create_asset')(views.AssetDuplicate.as_view()), name='asset_duplicate'), - path('asset/delete/', permission_required_with_403('assets.delete_asset')(views.asset_delete), name='ajax_asset_delete'), path('asset/search/', views.AssetSearch.as_view(), name='asset_search_json'), diff --git a/assets/views.py b/assets/views.py index 7a5eacbf..43352b79 100644 --- a/assets/views.py +++ b/assets/views.py @@ -122,18 +122,6 @@ class AssetDuplicate(DuplicateMixin, AssetCreate): return context -@login_required() -def asset_delete(request): - context = dict() - if request.method == 'POST' and request.is_ajax(): - asset = get_object_or_404(models.Asset, pk=request.POST.get('asset_id', None)) - asset.delete() - - context['url'] = reverse('asset_list') - - return HttpResponse(json.dumps(context), content_type='application/json') - - class SupplierList(generic.ListView): model = models.Supplier template_name = 'supplier_list.html'