Skip to Content
Django 3 Web Development Cookbook - Fourth Edition
book

Django 3 Web Development Cookbook - Fourth Edition

by Aidas Bendoraitis, Jake Kronika
March 2020
Intermediate to advanced
608 pages
17h 17m
English
Packt Publishing
Content preview from Django 3 Web Development Cookbook - Fourth Edition

How it works...

When you look at the results in the browser, you will see the pagination controls, similar to the follo wing:

How do we achieve this? When QuerySet is filtered out, we will create a paginator object passing QuerySet and the maximal amount of items that we want to show per page, which is 24 here. Then, we will read the current page number from the query parameter, page. The next step is to retrieve the current page object from the paginator. If the page number is not an integer, we get the first page. If the number exceeds the number of possible pages, the last page is retrieved. The page object has methods and attributes necessary ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Django 2 Web Development Cookbook - Third Edition

Django 2 Web Development Cookbook - Third Edition

Jake Kronika, Aidas Bendoraitis

Publisher Resources

ISBN: 9781838987428Supplemental Content