basci question about queryset for retrieving top element
Hello!
I want to get just the top element of one queryset. SO I have
something as
qs=MyModel.objects.filter(...).order_by(..)
and then use qs[0] and check some value
I wonder now if i did the right thing or it is better to use .extra on
queryset.
Is the queryset object allocated for all objects, or is django/python
smarter than me and gets only the needed object?
Should I maybe do directly
topObj=MyModel.objects.filter(...).order_by(..)[0]
What is better?
Thanks
Nenad
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home