Re: Django Pagination paginate dictionary of objects

2020-07-28 Thread jhabar singh
bro try to send a intended code On Tue, Jul 28, 2020 at 5:16 PM Harvindar Singh Garcha < garchaama...@gmail.com> wrote: > I am new to Django, and trying to paginate a dictionary objects, > However I am unable to so and not getting what's wrong with my code, > Its still printing whole data on a si

Re: Django Pagination

2020-06-01 Thread maninder singh Kumar
I think there might be a way around, below is the code modified for views.py @login_required def home_view(request): """Display all the post of friends and own posts on the dashboard""" posts = Post.objects.order_by('-date_posted') media: MEDIA_URL # 'post':Post.objects.filter(Q(author=request.use

Re: Django Pagination

2020-06-01 Thread Akshat Zala
Dear Sir, it shows all the text on all the pages. if there are total 5 posts, then it shows all the 5 posts on all the pages. Thanks, Akshat Zala On Saturday, 30 May 2020 20:54:35 UTC+5:30, maninder singh Kumar wrote: > > Views.py looks fine ! > > regards > willy > > > On Sat, May 30, 2020 at

Re: Django Pagination

2020-05-30 Thread Akshat Zala
Hi, if I change the template to: {% if not is_paginated %} {% if page_obj.has_previous %} First arrow_left {% endif %} {% for num in page_obj.paginator.page_range %} {% if page_obj.number == num %} {{ num }} {% elif num > page_obj.number|add:'-4' and num < page_obj.number|add:'4' %} {{ num }} {%

Re: Django Pagination

2020-05-30 Thread Chetan Ganji
Hi akshat, What is the difficulty? Where have you defined the variable is_paginated? Is it present in the context? On Sat, May 30, 2020, 8:53 PM maninder singh Kumar < maninder.s.ku...@gmail.com> wrote: > Views.py looks fine ! > > regards > willy > > > On Sat, May 30, 2020 at 7:22 PM Akshat Zal

Re: Django Pagination

2020-05-30 Thread maninder singh Kumar
Views.py looks fine ! regards willy On Sat, May 30, 2020 at 7:22 PM Akshat Zala wrote: > Hello, > > I am finding it difficult to paginate through all the posts > > My views.py : > > @login_required > def home_view(request): > """Display all the post of friends and own posts on the dashboard"""

Re: Django Pagination

2020-05-30 Thread Akshat Zala
On Saturday, 30 May 2020 19:20:47 UTC+5:30, Akshat Zala wrote: > > Hello, > > I am finding it difficult to paginate through all the posts > > My views.py : > > @login_required > def home_view(request): > """Display all the post of friends and own posts on the dashboard""" > posts = Post.objects.

Re: django pagination

2016-01-26 Thread Xristos Xristoou
i find solutio using https://docs.djangoproject.com/en/1.9/topics/pagination/ thnX Τη Τρίτη, 26 Ιανουαρίου 2016 - 3:10:06 μ.μ. UTC+2, ο χρήστης pa xapy έγραψε: > > you want to paginate both querysets at the same page? > i believe it's a pretty strange idea and if so, you should think how to > r

Re: django pagination

2016-01-26 Thread Xristos Xristoou
i foolow the steps but i have again error my new view : def index(request): try: page = request.GET.get('page', 1), except PageNotAnInteger: page = 1, objects = ['john', 'edward', 'josh', 'frank'] p = Paginator(objects,request=request) people = p.page(page)

Re: django pagination

2016-01-26 Thread Xristos Xristoou
that method is Confusing,i try to understand,i create new view or i work with current?i not understand it the using 'people' and object on they view Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post l

Re: django pagination

2016-01-26 Thread pa xapy
are you using python 3? that's actually what i talking about - it's too old try another one, like this https://github.com/jamespacileo/django-pure-pagination - follow the instructions and i hope you'll be fine On Tuesday, January 26, 2016 at 5:09:29 PM UTC+3, Xristos Xristoou wrote: > > i follow

Re: django pagination

2016-01-26 Thread Xristos Xristoou
i follow the simpe steps but i take error invalid syntax (pagination_tags.py, line 225) Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post list. i see docs and > examples for that but i thing my probl

Re: django pagination

2016-01-26 Thread Xristos Xristoou
thnx you i try to use that now Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post list. i see docs and > examples for that but i thing my problem is a specific, because on my view > i have two Querys

Re: django pagination

2016-01-26 Thread pa xapy
are you familiar with the pip utility? if not, i highly recommend to read about it https://pip.pypa.io/en/stable/quickstart/ if yes, you should know that you can install any application with pip install package_name and how set it up with django - it's better if you read in instructions for pack

Re: django pagination

2016-01-26 Thread Xristos Xristoou
one more question how to install this ?autopagination ?i dont see anything Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post list. i see docs and > examples for that but i thing my problem is a specif

Re: django pagination

2016-01-26 Thread pa xapy
you can read the usage doc i sent linked, but yes - you don't need to do anything with you queryset in view only pass it to template On Tuesday, January 26, 2016 at 4:39:17 PM UTC+3, Xristos Xristoou wrote: > > if i use {autopagination} i dont need quyre on my view ? > > Τη Δευτέρα, 25 Ιανουαρίου

Re: django pagination

2016-01-26 Thread Xristos Xristoou
if i use {autopagination} i dont need quyre on my view ? Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post list. i see docs and > examples for that but i thing my problem is a specific, because on my

Re: django pagination

2016-01-26 Thread pa xapy
if you'll decide to use some app for pagination, you can do it in template, like so https://github.com/ericflo/django-pagination/blob/master/docs/usage.txt ({% autopaginate posts 10 %}) or you can choose one of these https://www.djangopackages.com/grids/g/pagination/ there is no actual need to

Re: django pagination

2016-01-26 Thread Xristos Xristoou
can you show me one examples with my view ? Τη Δευτέρα, 25 Ιανουαρίου 2016 - 4:16:31 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: > > i want to using Paginator in my main page for my post list. i see docs and > examples for that but i thing my problem is a specific, because on my view > i hav

Re: django pagination

2016-01-26 Thread pa xapy
you want to paginate both querysets at the same page? i believe it's a pretty strange idea and if so, you should think how to refactor it if you want only paginate posts, i'll recommend you to use django-pagination app of some sort, it's can be used in template On Monday, January 25, 2016 at 5:

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Thanks for the help guys, I managed to solve, so I did: * queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* * * *try: * * page = int(request.POST.get('page','1')) * *except ValueError: * * page = 1 * *try:

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
thus still giving the same error -- 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+unsubscr...@googlegroups.com. To post to this group, send email to

Re: Django Pagination

2013-10-03 Thread Roberto López López
On 10/03/2013 04:13 PM, Roberto López López wrote: > *return HttpResponse(json.dumps([players]) , > content_type='application/json')* better without the square brackets *return HttpResponse(json.dumps(players) , content_type='application/json')* -- Roberto López López System Developer Paral

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
doing so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* * * *page = request.GET.get('page')* *try:* *players = paginator.page(page)* *except PageNotAnInteger:* *players = paginator.page(1)* *exc

Re: Django Pagination

2013-10-03 Thread Roberto López López
Try this (I have not tried the code myself, but I think that it should work): *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2) page = request.GET.get('page') try: players = paginator.page(page) except PageNotA

Re: Django Pagination

2013-10-03 Thread Roberto López López
Better to say: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2) page = request.GET.get('page') try: players = paginator.page(page) except PageNotAnInteger: players = paginator.page(1) excep

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Already got it, I did so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* *return HttpResponse(json.dumps([item.get_json() for item in paginator.object_list]) , content_type='application/json')* But I return all the records ... I should not retur

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Already got it, I did so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 1)* *return HttpResponse(json.dumps([item.get_json() for item in paginator.object_list]) , content_type='application/json')* But I return all the records ... I should not retur

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
I'm doing this: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 20)* *return json.dumps([item.get_json() for item in paginator.object_list])* And my Document is thus: http://plnkr.co/edit/FHH2hZh26OiLMKTk2ToO But it gives me the following error: 'st

Re: Django Pagination

2013-10-03 Thread Tom Christie
Hi Hélio, It looks like you're applying pagination to the rendered JSON string itself. You want to be paginating the queryset itself. queryset = Player.objects.filter(name=namepost) paginator = Paginator(queryset, 20) return json.dumps([item.to_dict() for item in paginator.object_list

Re: Django Pagination Not Working!

2012-05-08 Thread Tom Evans
On Sun, May 6, 2012 at 10:56 PM, coded kid wrote: > I'm trying to paginate a page in order to display five statuses per > page. After inputting these codes, it fails to paginate. Below are the > codes for pagination and updating of status in my django app. > > > Views: > >  def qask(request): >  

Re: Django pagination is repeating results

2011-02-24 Thread diogobaeder
Nevermind, it is a SQL Server problem. (I hate SQL Server. There, I said it.) I had to first filter manually by the m2m objects, then apply the pagination to the results. Thanks! On Feb 18, 2:53 pm, David De La Harpe Golden wrote: > On 18/02/11 17:38,diogobaederwrote: > > > Hi, > > Any ideas of

Re: Django pagination is repeating results

2011-02-18 Thread David De La Harpe Golden
On 18/02/11 17:38, diogobaeder wrote: > Hi, > Any ideas of what might be happening? > Have you set a Meta.ordering on your Model (or applied an .order_by() to the QuerySet?) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: django pagination

2010-08-06 Thread kostia
I don't have time to watch your code, but... Take a look here http://www.tummy.com/Community/Articles/django-pagination/ I set up this cool pagination in 15 minutes without errors! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-21 Thread tezro
Thanks again. Did it with object_list. Thanks for help :) On Oct 19, 2:16 pm, Михаил Лукин wrote: > Finally, I see only 3 ways: > 1. copy/paste archive index code and change it's behaviour so it can eat > num_latest=None > 2. patch date_based.py in same way as (1) > 3. use list_detail.object_lis

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-19 Thread Михаил Лукин
Finally, I see only 3 ways: 1. copy/paste archive index code and change it's behaviour so it can eat num_latest=None 2. patch date_based.py in same way as (1) 3. use list_detail.object_list Since 1-2 are dirty, I would recommend 3rd way. I'll let you know if I could suggest something else :) 2009/

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-19 Thread tezro
Surely I could use the list_detail.object_list, but the use of date based generics though )) On Oct 18, 11:45 pm, Михаил Лукин wrote: > Sorry, didn't look at condition well...:( > > So, you see the source and you see that there's no way to get all the > records with this view. > Why don't you u

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread Михаил Лукин
Sorry, didn't look at condition well...:( So, you see the source and you see that there's no way to get all the records with this view. Why don't you use list_detail.object_list view? If you need just to order list by date, you can use ordering on the model level: http://docs.djangoproject.com/en/

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread tezro
Would it? If "latest=None" doesn't it mean that there are no entries? By the way, if I pass None to the condition, it returns False, so latest is None. Or isn't it? Also the template cannot render it, cause "object of type 'NoneType' has no len()". Anyways, thanks for reply :) On Oct 18, 11

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread Mihail Lukin
Look at date_based.py: if date_list and num_latest: latest = queryset.order_by('-'+date_field)[:num_latest] else: latest = None So, if you use num_latest=None, you will always get the whole list. On Aug 30, 2:47 pm, tezro wrote: > Anyone? > > On Aug 14, 8:29 am, tezro

Re: django pagination

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 4:52 PM, Michael Ralan wrote: > > Hi, > > Apologies if this question has been asked before but I was not able to > find a satisfactory answer. > > In the django admin app there is a capability to have a pagination > object that lists the number of pages that can be paged. >

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-08-30 Thread tezro
Anyone? On Aug 14, 8:29 am, tezro wrote: > The question is that "django.views.generic.date_based.archive_index()" > takes an optional argument "num_latest" which is 15 by default. > Setting it manually to num_latest=10 is way off to correct to > me. It works. I suppose that it even doesn