Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[darglint]
strictness = short
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
select = ANN,B,B9,BLK,C,D,DAR,E,F,S,W
ignore = E203,E501,W503,C901,S308
select = B,B9,C,E,F,N,S,W
ignore = E203,E501,W503,C901,B950
max-line-length = 80
max-complexity = 10
docstring-convention = google
Expand Down
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ repos:
rev: 19.10b0
hooks:
- id: black
# - repo: https://gitlab.com/pycqa/flake8
# rev: 3.7.9
# hooks:
# - id: flake8
# additional_dependencies:
# - flake8-bandit==2.1.2
# - flake8-bugbear==20.1.4
# - flake8-docstrings==1.5.0
# - pep8-naming==0.10.0
# - darglint==1.2.3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bandit==2.1.2
- flake8-bugbear==20.1.4
- flake8-docstrings==1.5.0
- pep8-naming==0.10.0
- darglint==1.3.0
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.3.0
hooks:
Expand Down
54 changes: 6 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,20 @@
language: python

python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"

env:
- DJANGO="Django>=1.7.0,<1.8.0"
- DJANGO="Django>=1.8.0,<1.9.0"
- DJANGO="Django>=1.9.0,<1.10.0"
- DJANGO="Django>=1.10.0,<1.11.0"
- DJANGO="Django>=1.11.0,<2.0.0"
- DJANGO="Django>=2.0.0,<2.1.0"
- DJANGO="Django>=2.1.0,<2.2.0"

before_install:
- pip install poetry nox

install:
- pip install -q $DJANGO
- pip install coveralls
- poetry install

script:
- coverage run runtests.py

after_success:
- coveralls

matrix:
exclude:
- python: "3.5"
env: DJANGO="Django>=1.7.0,<1.8.0"
- python: "3.6"
env: DJANGO="Django>=1.7.0,<1.8.0"

- python: "3.6"
env: DJANGO="Django>=1.8.0,<1.9.0"

- python: "3.3"
env: DJANGO="Django>=1.9.0,<1.10.0"
- python: "3.6"
env: DJANGO="Django>=1.9.0,<1.10.0"

- python: "3.3"
env: DJANGO="Django>=1.10.0,<1.11.0"
- python: "3.6"
env: DJANGO="Django>=1.10.0,<1.11.0"

- python: "3.3"
env: DJANGO="Django>=1.11.0,<2.0.0"

- python: "2.7"
env: DJANGO="Django>=2.0.0,<2.1.0"
- python: "3.3"
env: DJANGO="Django>=2.0.0,<2.1.0"

- python: "2.7"
env: DJANGO="Django>=2.1.0,<2.2.0"
- python: "3.3"
env: DJANGO="Django>=2.1.0,<2.2.0"
- python: "3.4"
env: DJANGO="Django>=2.1.0,<2.2.0"
26 changes: 12 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ django-pagination-bootstrap

.. badges-begin

|Travis| |Python Version| |PyPi| |Black|
|Travis| |Python Version| |PyPi| |Black| |pre-commit|

.. |Travis| image:: https://api.travis-ci.org/staticdev/django-pagination-bootstrap.svg?branch=master
:target: https://travis-ci.org/staticdev/django-pagination-bootstrap

.. |Python Version| image:: https://img.shields.io/pypi/pyversions/django-pagination-bootstrap
:target: https://pypi.org/project/django-pagination-bootstrap
:alt: Python Version

.. |PyPi| image:: https://badge.fury.io/py/django-pagination-bootstrap.svg
:target: https://badge.fury.io/py/django-pagination-bootstrap

:alt: PyPI
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Black
.. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit

Django-pagination-bootstrap is an app to easy add pagination in Django_, using `Bootstrap`_'s layout.

Expand All @@ -44,7 +46,7 @@ We need to hook ``django-pagination-bootstrap`` into our project.

INSTALLED_APPS = (
# other apps
"django-pagination_bootstrap",
"django_pagination_bootstrap",
)

2. Install the pagination middleware. Your settings file might look something like:
Expand All @@ -56,22 +58,18 @@ We need to hook ``django-pagination-bootstrap`` into our project.
"django_pagination_bootstrap.middleware.PaginationMiddleware",
)

3. If it's not already added in your setup, add the request context processor. Note that context processors are set by default implicitly, so to set them explicitly, you need to copy and paste this code into your under the value TEMPLATE_CONTEXT_PROCESSORS.
3. Guarantee you have ``django.template.context_processors.request`` on settings.py:

.. code-block:: python

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
# ...
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
# ...
"django.template.context_processors.request"
# ...
],
},
},
Expand Down Expand Up @@ -111,7 +109,7 @@ That's it! You have now paginated object_list and given users of the site a way
Side effects
============

A django-paginator_ instance will be injected in the template context as ``paginator``. You can access it as usual::
A django-paginator_ instance will be injected in the template context as ``paginator``. You can access it as usual:

.. code-block:: python

Expand Down
17 changes: 13 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Nox sessions."""
import contextlib
import shutil
import tempfile
from pathlib import Path
from typing import cast
Expand All @@ -12,7 +11,7 @@

package = "django_pagination_bootstrap"
python_versions = ["3.8", "3.7", "3.6"]
nox.options.sessions = "pre-commit", "safety", "mypy", "tests"
nox.options.sessions = "pre-commit", "safety", "mypy" # , "tests"
locations = "src", "tests", "noxfile.py"


Expand Down Expand Up @@ -141,8 +140,18 @@ def tests(session: Session) -> None:
"""Run the test suite."""
install_package(session)
install(session, "coverage[toml]", "pytest")
session.run("coverage", "run", "-m", "pytest", *session.posargs)
session.run("coverage", "report")
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
session.notify("coverage")


@nox.session
def coverage(session: Session) -> None:
"""Produce the coverage report."""
args = session.posargs or ["report"]
install(session, "coverage[toml]")
if not session.posargs and any(Path().glob(".coverage.*")):
session.run("coverage", "combine")
session.run("coverage", *args)


@nox.session(python=python_versions)
Expand Down
Loading