Fix #565 -- OrderList ordering request handling (#566)

Fix missed out ordering get request handling.
This commit is contained in:
Daniel
2017-07-18 22:16:51 +08:00
committed by Raphael Michel
parent 99d614289e
commit 7e304bb231

View File

@@ -59,6 +59,13 @@ class OrderList(EventPermissionRequiredMixin, ListView):
if self.filter_form.is_valid():
qs = self.filter_form.filter_qs(qs)
if self.request.GET.get("ordering", "") != "":
p = self.request.GET.get("ordering", "")
p_admissable = ('-code', 'code', '-email', 'email', '-total', 'total', '-datetime',
'datetime', '-status', 'status', 'pcnt', '-pcnt')
if p in p_admissable:
qs = qs.order_by(p)
return qs.distinct()
def get_context_data(self, **kwargs):