Hi,

I'm wondering if there is an efficient way to look-up the index of a given
object in a query-set? I'm using now the following approach:

def get_index (id):

bids = BID.objects.filter (..)
obj2idx = dict (zip (bids, xrange (bids.count ()))

bid = BID.objects.get (id=ID)

return obj2idx (bid)

This has a linear time processing.. is there a more efficient way to do it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to