Thursday, October 31, 2013

slice QuerySet and keep as QuerySet

How do I slice a QuerySet and keep it as a QuerySet


If I do

a = qs[:3]

then I get a list back. I want a QuerySet.


I'm wanting to get the first x items in the query set and the last x items in the query set.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b349138c-47f7-41fd-9fcf-db3fba7c40f9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment