Thursday, October 31, 2013

Re: slice QuerySet and keep as QuerySet

On 1/11/2013 12:01pm, brian wrote:
> *How do I slice a QuerySet and keep it as a QuerySet*
>

https://docs.djangoproject.com/en/1.5/ref/models/querysets/#when-querysets-are-evaluated

https://docs.djangoproject.com/en/1.5/ref/models/querysets/#methods-that-return-new-querysets

>
> *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.

--
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/52730A0A.9040202%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment