Monday, October 31, 2016

Re: Using django pagination or slicing

Thanks fedowag.

On Oct 31, 2016 12:01 PM, "王安刚" <fedowag@gmail.com> wrote:
hi 
i prefer method 2

you can get all the list from db and store it in redis using zadd
each time an ajax request comes, you get the data you need using zrange


在 2016年10月31日星期一 UTC+8上午9:05:07,ADEWALE ADISA写道:

Hello,
Please I need an advice on the best approach to take on the following issues.
I have a database table consist of about 1000 record. I need to be displaying like 20 records at a time on a page such that when the user scroll the browser another batches will be append to the browser.
Below are the 3 ways am aiming to achieve this:

1. Using django pagination feature.

2. Everytime records need to be appended to the browser , an ajax call is made to the view, then the queryset is slice using appropriate lower and upper band. Then the returned record is appended to the browser.

3. Fetch the whole records from the database and transfer everything to the browser, then JavaScript is now use to slice and be appending as needed.

NOTE: The webpage would work like yahoo.com mobile site.
Please with approach is the best in term of performance and speed.

Thanks.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/022fd700-0edb-419c-9a0d-6e9714229599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMGzuy-s8X495UAXuQTibAXe9VLumhMvSUEhzo_rb55T4%3DsQ7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment