django simple pagination Documentation

Similar documents
Django MFA Documentation

Django EL(Endless) Pagination Documentation

django-messages Documentation

alphafilter Documentation

django-idioticon Documentation

Signals Documentation

django-responsive2 Documentation

django-reinhardt Documentation

django-cas Documentation

Python Project Example Documentation

django-stored-messages Documentation

Django Wordpress API Documentation

Python wrapper for Viscosity.app Documentation

Roman Numeral Converter Documentation

chatterbot-weather Documentation

Django-frontend-notification Documentation

django-users2 Documentation

nacelle Documentation

Python Schema Generator Documentation

FAQ Q: Where/in which branch do I create new code/modify existing code? A: Q: How do I commit new changes? A:

Python simple arp table reader Documentation

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

dj-libcloud Documentation

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

django-generic-filters Documentation

Mantis STIX Importer Documentation

open-helpdesk Documentation

Aircrack-ng python bindings Documentation

I2C LCD Documentation

django CMS Export Objects Documentation

django-private-chat Documentation

Github/Git Primer. Tyler Hague

TPS Documentation. Release Thomas Roten

django-dynamic-db-router Documentation

contribution-guide.org Release

sainsmart Documentation

django-konfera Documentation

Release Nicholas A. Del Grosso

PyCRC Documentation. Release 1.0

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -

django-telegram-bot Documentation

smsghussd Documentation

google-search Documentation

Simple libtorrent streaming module Documentation

Esri on GitHub: How to Participate in Open Source Projects

Redis Timeseries Documentation

django-dajaxice Documentation

withenv Documentation

Using GitHub and SourceTree to work with DITA TC repositories

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

django-bootstrap3 Documentation

Object Oriented Programming. Week 1 Part 2 Git and egit

git-pr Release dev2+ng5b0396a

Release Fulfil.IO Inc.

PyZillow Documentation

Tizen/Artik IoT Practice Part 4 Open Source Development

Tips on how to set up a GitHub account:

Software Development I

django-intercom Documentation

Effective Software Development and Version Control

Git for Subversion users

django-amp-tools Documentation Release latest

Poetaster. Release 0.1.1

Game Server Manager Documentation

Google Domain Shared Contacts Client Documentation

Python data pipelines similar to R Documentation

git-flow Documentation

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

django-composite-foreignkey Documentation

CID Documentation. Release Francis Reyes

django-baton Documentation

django-flickr Documentation

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

DNS Zone Test Documentation

Gearthonic Documentation

Python State Machine Documentation

Git, the magical version control

PyCon APAC 2014 Documentation

Aldryn Installer Documentation

Poulpe Documentation. Release Edouard Klein

CSC 2700: Scientific Computing

How to git with proper etiquette

Visualizing Git Workflows. A visual guide to 539 workflows

Submitting your Work using GIT

b. Developing multiple versions of a software project in parallel

Pykemon Documentation

TailorDev Contact Documentation

django-composite-foreignkey Documentation

django-baton Documentation

Configuring Git. Matthieu Moy. configuring-git-slides.

The Old World. Have you ever had to collaborate on a project by

wagtailtrans Documentation

django-image-cropping Documentation

Django Phantom Theme Documentation

smartfilesorter Documentation

Bricks Documentation. Release 1.0. Germano Guerrini

Introduction to Git and Github Repositories

Simple Binary Search Tree Documentation

Version Control Systems

eventbrite-sdk-python Documentation

Transcription:

django simple pagination Documentation Release 1.1.5 Micro Pyramid Nov 08, 2017

Contents 1 Getting started 3 1.1 Requirements............................................... 3 1.2 Installation................................................ 3 1.3 Settings.................................................. 3 1.4 Quickstart................................................ 4 2 Simple pagination 5 3 Templatetags reference 7 3.1 paginate.................................................. 7 3.2 show_pageitems............................................. 7 4 Settings 9 4.1 SIMPLE_PAGINATION_PER_PAGE................................. 9 4.2 ENDLESS_PAGINATION_PAGE_LABEL............................... 9 4.3 SIMPLE_PAGINATION_NEXT_LABEL................................ 9 4.4 SIMPLE_PAGINATION_PREVIOUS_LABEL............................ 9 4.5 SIMPLE_PAGINATION_LAST_LABEL................................ 9 4.6 SIMPLE_PAGINATION_FIRST_LABEL............................... 10 5 Contributing 11 5.1 Sending pull requests........................................... 11 i

ii

django simple pagination Documentation, Release 1.1.5 This application provides simple Digg-style pagination. It is devoted to implementing web pagination in very few steps. The source code for this app is hosted at https://github.com/micropyramid/django-simple-pagination.git Getting started is easy! Contents: Contents 1

django simple pagination Documentation, Release 1.1.5 2 Contents

CHAPTER 1 Getting started 1.1 Requirements Python >= 2.6 (or Python 3) Django >= 1.3 jquery >= 1.7 1.2 Installation The Git repository can be cloned with this command: git clone https://github.com/micropyramid/django-simple-pagination.git The simple_pagination package, included in the distribution, should be placed on the PYTHONPATH. Otherwise you can just easy_install -Z django-simple-pagination or pip install django-simple-pagination. 1.3 Settings Add the request context processor to your settings.py, e.g.: from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_CONTEXT_PROCESSORS += ( 'django.core.context_processors.request', ) Add 'simple_pagination' to the INSTALLED_APPS to your settings.py. See the Settings section for other settings. 3

django simple pagination Documentation, Release 1.1.5 1.4 Quickstart Given a template like this: {% for item in items %} {# your code to show the item #} {% endfor %} you can use simple Digg-style pagination to display objects just by adding: {% load paginate %} {% paginate items %} {% for item in items %} {# your code to show the item #} {% endfor %} {% show_pageitems %} Done. This is just a basic example. To continue exploring all the Django Simple Pagination features, have a look at Simple pagination. 4 Chapter 1. Getting started

CHAPTER 2 Simple pagination Simple pagination is nothing but a basic Digg-style pagination of queryset objects. It is really easy to implement. All you have to do is modifying the template, e.g.: {% load paginate %} {% paginate items %} {% for item in items %} {# your code to show the item #} {% endfor %} {% show_pageitems %} That s it! As seen, the paginate template tag takes care of customizing the given queryset and the current template context. The show_pageitems one displays the page links allowing for navigation to other pages including previous, next, first and last links. 5

django simple pagination Documentation, Release 1.1.5 6 Chapter 2. Simple pagination

CHAPTER 3 Templatetags reference 3.1 paginate Usage: {% paginate items %} After this call, the items variable in the template context is replaced by only the entries of the current page. You can also keep your items original variable (usually a queryset) and add to the context another name that refers to items of the current page, e.g.: {% paginate items as page_items %} The as argument is also useful when a nested context variable is provided as queryset. The number of paginated items is taken from SIMPLE_PAGINATION_PER_PAGE setting, but you can override the default locally, e.g.: {% paginate 20 items %} Of course you can mix it all: {% paginate 20 items as paginated_items %} 3.2 show_pageitems Usage: {% show_pageitems %} This call in the template will give a digg-style page sequence that contain following values with other page links: 7

django simple pagination Documentation, Release 1.1.5 previous : will display the previous page in that position; next : will display the next page in that position; first : will display the first page as an arrow; last : will display the last page as an arrow; This must be called after paginate. 8 Chapter 3. Templatetags reference

CHAPTER 4 Settings 4.1 SIMPLE_PAGINATION_PER_PAGE Default: 10 This tells the pagiante tag how many objects are normally displayed in a page (overwriteable by templatetag). 4.2 ENDLESS_PAGINATION_PAGE_LABEL Default: 'page' This is the the querystring key of the page number (e.g. http://example.com?page=2). 4.3 SIMPLE_PAGINATION_NEXT_LABEL Default: '<span aria-hidden="true">></span>' This is the default label for the previous page link. 4.4 SIMPLE_PAGINATION_PREVIOUS_LABEL Default '<span aria-hidden="true"><</span>' This is the default label for the next page link. 4.5 SIMPLE_PAGINATION_LAST_LABEL Default: '<span aria-hidden="true">>></span>' 9

django simple pagination Documentation, Release 1.1.5 This is the default label for the last page link. 4.6 SIMPLE_PAGINATION_FIRST_LABEL Default: '<span aria-hidden="true"><<</span>' This is the default label for the first page link. 10 Chapter 4. Settings

CHAPTER 5 Contributing Feel free to create a new Pull request if you want to propose a new feature or fix a bug. 5.1 Sending pull requests 1. Fork the repo: https://github.com/micropyramid/django-simple-pagination.git 2. Create a branch for your specific changes: $ git checkout master $ git pull $ git checkout -b feature To simplify things, please, make one branch per issue (pull request). It s also important to make sure your branch is up-to-date with upstream master, so that maintainers can merge changes easily. 3. Commit changes. Please update docs, if relevant. 4. Don t forget to run tests to check than nothing breaks. 5. Ideally, write your own tests for new feature/bug fix. 6. Submit a pull request. 11