From 0bffcaa4211c0039e42542cd98eeb88925ac66a3 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 25 Jan 2011 20:53:21 +0530 Subject: [PATCH] autocomplete also needs nulls_last --- pandora/item/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index a140ec737..9abce4270 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -281,7 +281,7 @@ def autocomplete(request): qs = qs.filter(find__key=data['key'], find__value__istartswith=data['value']) elif op == '$': qs = qs.filter(find__key=data['key'], find__value__iendswith=data['value']) - qs = qs.order_by(order_by) + qs = qs.order_by(order_by, nulls_last=True) qs = qs[data['range'][0]:data['range'][1]] response = json_response({}) response['data']['items'] = [i.get(data['key']) for i in qs]