From c3ef8d2dfbfa197a8dafd8f5842d5278ffea5ce6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 29 Jun 2021 09:14:26 +1000 Subject: [PATCH] Fixes for model renderers --- InvenTree/templates/js/api.js | 8 ++++++++ InvenTree/templates/js/model_renderers.js | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/api.js b/InvenTree/templates/js/api.js index aa446028a5..5e8905a1dd 100644 --- a/InvenTree/templates/js/api.js +++ b/InvenTree/templates/js/api.js @@ -18,7 +18,15 @@ function getCookie(name) { } function inventreeGet(url, filters={}, options={}) { + + // Middleware token required for data update + //var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val(); + var csrftoken = getCookie('csrftoken'); + return $.ajax({ + beforeSend: function(xhr, settings) { + xhr.setRequestHeader('X-CSRFToken', csrftoken); + }, url: url, type: 'GET', data: filters, diff --git a/InvenTree/templates/js/model_renderers.js b/InvenTree/templates/js/model_renderers.js index ae32c06eff..24e9c1d328 100644 --- a/InvenTree/templates/js/model_renderers.js +++ b/InvenTree/templates/js/model_renderers.js @@ -18,6 +18,8 @@ function renderCompany(name, data, parameters, options) { var html = `${data.name} - ${data.description}`; + html += `{% trans "Company ID" %}: ${data.pk}`; + return html; } @@ -39,6 +41,8 @@ function renderStockLocation(name, data, parameters, options) { html += ` - ${data.description}`; } + html += `{% trans "Location ID" %}: ${data.pk}`; + if (data.pathstring) { html += `

${data.pathstring}

`; } @@ -64,6 +68,8 @@ function renderPart(name, data, parameters, options) { html += ` - ${data.description}`; } + html += `{% trans "Part ID" %}: ${data.pk}`; + return html; } @@ -77,7 +83,7 @@ function renderPartCategory(name, data, parameters, options) { html += ` - ${data.description}`; } - html += `{% trans "Location ID" %}: ${data.pk}`; + html += `{% trans "Category ID" %}: ${data.pk}`; if (data.pathstring) { html += `

${data.pathstring}

`;