From 93243a7be706b5415ec51cd0f18089c1ddd0124a Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 24 Oct 2011 00:53:51 +0100 Subject: [PATCH] make object_id handling a little cleaner, tho still broken --- itf/app/models.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index e170854..5558ab1 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -256,14 +256,6 @@ class ItfModel(models.Model): except: qset = kls.objects.all() - if options['object_id'] != False and options['object_id'] != '': - object_id = options['object_id'] - qset = qset.exclude(pk=object_id) - try: - obj = kls.objects.get(pk=object_id) - ret.append(obj.list_dict()) - except: - pass search = options['search'] if search != '': @@ -295,6 +287,17 @@ class ItfModel(models.Model): for r in results.object_list: ret.append(r.list_dict()) + #FIXME: object_id needs to do something more graceful, this breaks sort. + if options['object_id'] != False and options['object_id'] != '': + object_id = options['object_id'] + qset = qset.exclude(pk=object_id) + try: + obj = kls.objects.get(pk=object_id) + ret.append(obj.list_dict()) + except: + pass + + return { 'page_no': page_no, 'num_pages': paginator.num_pages,