mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Instead of creating a custom filter for "latest" parts,
simply make use of the existing "ordering" query as part of DRF
This commit is contained in:
@ -55,10 +55,12 @@ InvenTree | Index
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
loadPartTable("#latest-parts-table", "{% url 'api-part-list' %}", {
|
||||
loadSimplePartTable("#latest-parts-table", "{% url 'api-part-list' %}", {
|
||||
params: {
|
||||
"latest_parts": true,
|
||||
}
|
||||
ordering: "-creation_date",
|
||||
limit: 10,
|
||||
},
|
||||
name: 'latest_parts',
|
||||
});
|
||||
|
||||
loadPartTable("#starred-parts-table", "{% url 'api-part-list' %}", {
|
||||
|
@ -155,6 +155,14 @@ function loadPartVariantTable(table, partId, options) {
|
||||
}
|
||||
|
||||
|
||||
function loadSimplePartTable(table, url, options={}) {
|
||||
|
||||
options.disableFilters = true;
|
||||
|
||||
loadPartTable(table, url, options);
|
||||
}
|
||||
|
||||
|
||||
function loadPartTable(table, url, options={}) {
|
||||
/* Load part listing data into specified table.
|
||||
*
|
||||
@ -332,7 +340,7 @@ function loadPartTable(table, url, options={}) {
|
||||
method: 'get',
|
||||
queryParams: filters,
|
||||
groupBy: false,
|
||||
name: 'part',
|
||||
name: options.name || 'part',
|
||||
original: params,
|
||||
formatNoMatches: function() { return "{% trans "No parts found" %}"; },
|
||||
columns: columns,
|
||||
|
Reference in New Issue
Block a user