Questions tagged [django-pagination]

Django-pagination refers to the Django (a Python-based and open-source web framework) way of managing data split across several pages, with "Previous/Next" links. Use this tag for questions related to classes related to pagination in Django.

Django-pagination refers to the Django (a Python-based and open-source web framework) way of managing data split across several pages, with "Previous/Next" links. Use this tag for questions related to classes related to pagination in Django.

300 questions
4
votes
1 answer

Django pagination in filtered search post results

I have a view that filters out results for a posted search form: def profile_advanced_search(request): args = {} if request.method == "POST": form = AdvancedSearchForm(request.POST) qs=[] if form.is_valid(): …
supermario
  • 2,625
  • 4
  • 38
  • 58
4
votes
4 answers

Django: paginated ListView database performance

I have a ListView with pagination: class StoriesListView(ListView): model = Story paginate_by = 20 def get_queryset(self): return Story.objects.all().order_by('-updated_at') I have 1000 Story objects in the database. What…
netimen
  • 4,199
  • 6
  • 41
  • 65
4
votes
0 answers

Django Pagination return json

I'm here with a problem that does not quite know how to solve. I have this query: result = json.dumps([a.get_json() for a in Player.objects.filter(name=namepost)]) But now I want to return the result with paging, and do not really know how to do…
Helio
  • 81
  • 4
3
votes
2 answers

Django Paginator raising TypeError

I'm trying to use the django pagination module including in the standard distribution version 1.3. When attempting to load a page that is currently controlled by pagination, if I do not include ?page= on the uri, it throws a TypeError. I've never…
Llanilek
  • 3,386
  • 5
  • 39
  • 65
3
votes
2 answers

How do I paginate WeekArchiveView?

In continuation of my struggle with WeekArchiveView, how do I paginate it by week? All I want is: to know if there is next / previous week available; in case there is, provide a link in the template. I'd like it to also skip empty weeks. The…
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
3
votes
1 answer

paginator function not working in django?

My issue is that i want to retrieve only 6 objects per page but its showing all 10 per page my view def home(request): if request.method == 'GET': entry = Entry.objects.all().order_by('date_added') # top_rated =…
Atif Shafi
  • 954
  • 1
  • 11
  • 26
3
votes
0 answers

COUNT field not set during pagination in django

i have created an API end-point using with custom method. This returns a paginated response. but when i try to get response after filtering records i get following error. lib/python3.6/site-packages/sql_server/pyodbc/base.py", line 575, in…
onkar
  • 31
  • 2
3
votes
1 answer

Django Filter - Paginate results

I'm using django-filter to output filtered results of my model. No issues there. Next step is adding a paginator.. though struggling for days now. views.py: def funds_overview(request): f = FundFilter(request.GET, queryset=Fund.objects.all()).qs …
TMD
  • 191
  • 1
  • 2
  • 14
3
votes
2 answers

Django Rest Framework global pagination and pagination_class are not working

My settings: REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 2 } My pagination Class: from rest_framework.pagination import PageNumberPagination class…
Sara
  • 69
  • 2
  • 9
3
votes
1 answer

Pagination doesn't accept dict as data - unhashable type

I'm trying to use Django pagination Pagination Docs. But I'm receiving this error: TypeError at / unhashable type Which is basically because I'm using a dictionary as my object and not a queryset. I would like to know if there is a way to turn my…
Filipe Ferminiano
  • 8,373
  • 25
  • 104
  • 174
3
votes
1 answer

Display item numbers with django paginator.

I want to display the item number with the items in a page using django paginator. I want to display the item number in front of item in a page for example: If i have total 15 items and my paginator code display 10 items per page then on first page…
Nidhi
  • 217
  • 1
  • 4
  • 14
3
votes
2 answers

How to set language for django-pagination?

As you can see, django-pagination has polish (pl) translations - https://github.com/ericflo/django-pagination/tree/master/pagination/locale but I dont know, how to set polish language for django-pagination? (default english)
David Silva
  • 1,939
  • 7
  • 28
  • 60
2
votes
1 answer

How to use pagination in class-based generic views?

I try to implement pagination to class-based generic view and in way I did it, it's not works. urls url(r'^cat/(?P[\w+\s]*)/page(?P[0-9]+)/$', CategorizedPostsView.as_view(), {'paginate_by': 3}), view class…
I159
  • 29,741
  • 31
  • 97
  • 132
2
votes
2 answers

Add new values at Django rest framework pagination

I want to add 'isSuccess' at the pagination returns. For example, { "count": 1234, "next": "http://mydomain/?page=2", "previous": null, "isSuccess" : 'Success' # <---- this one "results": [ { 'id':123, …
2
votes
7 answers

Django| Reverse for 'user-posts' with arguments '('',)' not found. 1 pattern(s) tried: ['user/(?P[^/]+)$']

I am following django tutorial by @CoreyMSchafer. I got error while practicing i can't find solution to it. According to my understanding its problem with reversing of url. but can't find out what is wrong Error: NoReverseMatch at / Reverse for…
nikbhintade
  • 21
  • 1
  • 1
  • 3
1 2
3
19 20