Skip to content

Commit 045f81d

Browse files
committed
readme badges
1 parent 72f7aae commit 045f81d

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
# infinite-scroll-pagination [![Build Status](https://travis-ci.org/nitely/django-infinite-scroll-pagination.png)](https://travis-ci.org/nitely/django-infinite-scroll-pagination) [![Coverage Status](https://coveralls.io/repos/nitely/django-infinite-scroll-pagination/badge.png?branch=master)](https://coveralls.io/r/nitely/django-infinite-scroll-pagination?branch=master)
1+
# infinite-scroll-pagination
2+
3+
[![Build Status](https://img.shields.io/travis/nitely/django-infinite-scroll-pagination
4+
/master.svg?style=flat-square)](https://travis-ci.org/nitely/django-infinite-scroll-pagination
5+
)
6+
[![Coverage Status](https://img.shields.io/coveralls/nitely/django-infinite-scroll-pagination
7+
/master.svg?style=flat-square)](https://coveralls.io/r/nitely/django-infinite-scroll-pagination
8+
)
9+
[![pypi](https://img.shields.io/pypi/v/django-infinite-scroll-pagination
10+
.svg?style=flat-square)](https://pypi.python.org/pypi/django-infinite-scroll-pagination
11+
)
12+
[![licence](https://img.shields.io/pypi/l/django-infinite-scroll-pagination
13+
.svg?style=flat-square)](https://raw.githubusercontent.com/nitely/django-infinite-scroll-pagination
14+
/master/LICENSE)
215

316
infinite-scroll-pagination is a Django lib that implements
417
[the seek method](http://use-the-index-luke.com/sql/partial-results/fetch-next-page)
5-
(AKA Keyset Paging and Cursor Pagination) for scalable pagination.
18+
(AKA Keyset Paging or Cursor Pagination) for scalable pagination.
619

720
> Note despite its name, this library can be used as a regular paginator,
8-
a better name would have been ``seek-paginator``, ``keyset-paginator`` or
9-
``cursor-paginator`` but it's too late for that now, haha :D
21+
a better name would have been ``seek-paginator``, ``keyset-paginator``,
22+
``cursor-paginator`` or ``offset-less-paginator`` but it's too late for that now, haha :D
1023

1124
## How it works
1225

@@ -23,7 +36,7 @@ Nor do rows mysteriously vanish between pages. These anomalies are common
2336
with the *offset/limit* based approach, but the *keyset* based solution does
2437
a much better job at avoiding them.
2538
* is fast: all operations can be solved with a fast row positioning followed
26-
by a range scan in the desired direction
39+
by a range scan in the desired direction.
2740

2841
For a full explanation go to
2942
[the seek method](http://use-the-index-luke.com/sql/partial-results/fetch-next-page)
@@ -35,14 +48,20 @@ infinite-scroll-pagination requires the following software to be installed:
3548
* Python 2.7, 3.4, 3.5 or 3.6
3649
* Django 1.11 LTS, 2.0 or 2.1
3750

51+
## Install
52+
53+
```
54+
pip install django-infinite-scroll-pagination
55+
```
56+
3857
## Django Rest Framework (DRF)
3958

4059
DRF has the built-in `CursorPagination`
4160
that is similar to this lib. Use that instead.
4261

4362
## Usage
4463

45-
This example pages by a `created_at` date field:
64+
This example paginates by a `created_at` date field:
4665

4766
```python
4867
# views.py
@@ -91,7 +110,7 @@ def pagination_ajax(request):
91110
return HttpResponse(json.dumps(data), content_type="application/json")
92111
```
93112

94-
Paging by pk, id or some `unique=True` field:
113+
Paginating by pk, id or some `unique=True` field:
95114

96115
```python
97116
page = paginator.paginate(queryset, lookup_field='pk', value=pk, per_page=20)
@@ -104,7 +123,7 @@ there is a serializers that will convert both values to ``timestamp-pk``,
104123
for example: ``1552349160.099628-5``, this can be later be used
105124
as a query string ``https://.../articles/?p=1552349160.099628-5``.
106125
There is no need to do the conversion client side, the server can send
107-
the next/previous page keyset serialized, as shown in the "Usage" section
126+
the next/previous page keyset serialized, as shown in the "Usage" section.
108127

109128
Serialize:
110129

@@ -135,7 +154,7 @@ class Article(models.Model):
135154
models.Index(fields=['-created_at', '-pk'])]
136155
```
137156

138-
> Note: an index is require for each direction,
157+
> Note: an index is require for both directions,
139158
since the query has a `LIMIT`.
140159
See [indexes-ordering](https://www.postgresql.org/docs/9.3/indexes-ordering.html)
141160

@@ -170,7 +189,7 @@ page = paginator.paginate(
170189

171190
Feel free to check out the source code and submit pull requests.
172191

173-
You may also report any bug or propose new features in the
192+
Please, report any bug or propose new features in the
174193
[issues tracker](https://github.com/nitely/django-infinite-scroll-pagination/issues)
175194

176195
## Copyright / License

0 commit comments

Comments
 (0)