diff --git a/InvenTree/common/api.py b/InvenTree/common/api.py index 6da2f98472..e1a9a0e3f0 100644 --- a/InvenTree/common/api.py +++ b/InvenTree/common/api.py @@ -5,7 +5,7 @@ Provides a JSON API for common components. # -*- coding: utf-8 -*- from __future__ import unicode_literals -from rest_framework import permissions, generics +from rest_framework import permissions, generics, filters from django.conf.urls import url @@ -27,7 +27,11 @@ class CurrencyList(generics.ListCreateAPIView): permissions.IsAuthenticated, ] - ordering_fields = ['name', 'value'] + filter_backends = [ + filters.OrderingFilter, + ] + + ordering_fields = ['suffix', 'value'] common_api_urls = [ diff --git a/InvenTree/templates/InvenTree/settings/currency.html b/InvenTree/templates/InvenTree/settings/currency.html index 662df702aa..1ca854e64b 100644 --- a/InvenTree/templates/InvenTree/settings/currency.html +++ b/InvenTree/templates/InvenTree/settings/currency.html @@ -15,6 +15,9 @@ $("#currency-table").bootstrapTable({ url: "{% url 'api-currency-list' %}", + queryParams: { + ordering: 'suffix' + }, sortable: true, search: true, formatNoMatches: function() { return "No currencies found"; }, @@ -38,14 +41,17 @@ { field: 'suffix', title: 'Currency', + sortable: true, }, { field: 'description', title: 'Description', + sortable: true, }, { field: 'value', title: 'Value', + sortable: true, } ] });