make object_id handling a little cleaner, tho still broken

This commit is contained in:
Sanj 2011-10-24 00:53:51 +01:00
parent 5603c0fefa
commit 93243a7be7

View File

@ -256,14 +256,6 @@ class ItfModel(models.Model):
except: except:
qset = kls.objects.all() 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'] search = options['search']
if search != '': if search != '':
@ -295,6 +287,17 @@ class ItfModel(models.Model):
for r in results.object_list: for r in results.object_list:
ret.append(r.list_dict()) 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 { return {
'page_no': page_no, 'page_no': page_no,
'num_pages': paginator.num_pages, 'num_pages': paginator.num_pages,