mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Sort currency API
This commit is contained in:
parent
873faee040
commit
6752bdc1c6
@ -5,7 +5,7 @@ Provides a JSON API for common components.
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from rest_framework import permissions, generics
|
from rest_framework import permissions, generics, filters
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
@ -27,7 +27,11 @@ class CurrencyList(generics.ListCreateAPIView):
|
|||||||
permissions.IsAuthenticated,
|
permissions.IsAuthenticated,
|
||||||
]
|
]
|
||||||
|
|
||||||
ordering_fields = ['name', 'value']
|
filter_backends = [
|
||||||
|
filters.OrderingFilter,
|
||||||
|
]
|
||||||
|
|
||||||
|
ordering_fields = ['suffix', 'value']
|
||||||
|
|
||||||
|
|
||||||
common_api_urls = [
|
common_api_urls = [
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
|
|
||||||
$("#currency-table").bootstrapTable({
|
$("#currency-table").bootstrapTable({
|
||||||
url: "{% url 'api-currency-list' %}",
|
url: "{% url 'api-currency-list' %}",
|
||||||
|
queryParams: {
|
||||||
|
ordering: 'suffix'
|
||||||
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
search: true,
|
search: true,
|
||||||
formatNoMatches: function() { return "No currencies found"; },
|
formatNoMatches: function() { return "No currencies found"; },
|
||||||
@ -38,14 +41,17 @@
|
|||||||
{
|
{
|
||||||
field: 'suffix',
|
field: 'suffix',
|
||||||
title: 'Currency',
|
title: 'Currency',
|
||||||
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'description',
|
field: 'description',
|
||||||
title: 'Description',
|
title: 'Description',
|
||||||
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'value',
|
field: 'value',
|
||||||
title: 'Value',
|
title: 'Value',
|
||||||
|
sortable: true,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user