Fixes for model renderers

This commit is contained in:
Oliver 2021-06-29 09:14:26 +10:00
parent ed2f21f583
commit c3ef8d2dfb
2 changed files with 15 additions and 1 deletions

View File

@ -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,

View File

@ -18,6 +18,8 @@ function renderCompany(name, data, parameters, options) {
var html = `<span>${data.name}</span> - <i>${data.description}</i>`;
html += `<span class='float-right'>{% trans "Company ID" %}: ${data.pk}</span>`;
return html;
}
@ -39,6 +41,8 @@ function renderStockLocation(name, data, parameters, options) {
html += ` - <i>${data.description}</i>`;
}
html += `<span class='float-right'>{% trans "Location ID" %}: ${data.pk}</span>`;
if (data.pathstring) {
html += `<p><small>${data.pathstring}</small></p>`;
}
@ -64,6 +68,8 @@ function renderPart(name, data, parameters, options) {
html += ` - <i>${data.description}</i>`;
}
html += `<span class='float-right'>{% trans "Part ID" %}: ${data.pk}</span>`;
return html;
}
@ -77,7 +83,7 @@ function renderPartCategory(name, data, parameters, options) {
html += ` - <i>${data.description}</i>`;
}
html += `<span class='float-right'>{% trans "Location ID" %}: ${data.pk}</span>`;
html += `<span class='float-right'>{% trans "Category ID" %}: ${data.pk}</span>`;
if (data.pathstring) {
html += `<p><small>${data.pathstring}</small></p>`;