Re: Question: Regarding Page class

2021-11-22 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Hi, could you give an example of what you're talking about?

As far as I can see, Paginator *never* converts its arguments to a list:

In [8]: paginator = Paginator(Game.objects.order_by('id'), 2)

In [9]: paginator.get_page(1)
Out[9]: 

In [10]: paginator.get_page(1).object_list
Out[10]: , ]>

Internally it uses the name object_list, but this is just a name for any
iterable.

On Sat, 20 Nov 2021 at 13:43, Gullapalli Saisurya Revanth <
g.revant...@gmail.com> wrote:

> Hi,
> While working with pagination I have observed that after splitting a
> queryset into pages. Each page that is initially of type queryset is
> converted to list before returning.
>
> Is there any reason why it's converted to list? I see that we can still
> get a queryset by slicing it which we could do so in Page class. If it is a
> queryset and not a list, we can add more columns or do some more
> computation on the queryset of a page even before evaluating. Right now as
> it is a list the queryset is already evaluated and we need to do one more
> query to add some columns to the page.
>
> Let me know if I am wrong or there are any reasons to use list instead of
> a queryset for a page.
>
> Thanks,
> Revanth
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/b0eb3ad8-4303-4517-aebc-05a9385d295dn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3c3jMcoDhkdhkNETAi7UGco%3DwsJNAZHa7P8YGhpBPn5g%40mail.gmail.com.


Question: Regarding Page class

2021-11-20 Thread Gullapalli Saisurya Revanth
Hi,
While working with pagination I have observed that after splitting a 
queryset into pages. Each page that is initially of type queryset is 
converted to list before returning. 

Is there any reason why it's converted to list? I see that we can still get 
a queryset by slicing it which we could do so in Page class. If it is a 
queryset and not a list, we can add more columns or do some more 
computation on the queryset of a page even before evaluating. Right now as 
it is a list the queryset is already evaluated and we need to do one more 
query to add some columns to the page.

Let me know if I am wrong or there are any reasons to use list instead of a 
queryset for a page.

Thanks,
Revanth

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b0eb3ad8-4303-4517-aebc-05a9385d295dn%40googlegroups.com.