Skip to main content

Include Django URL patterns with decorators

Project description

Include Django URL patterns with decorators.

Maintained by Stéphane “Twidi” Angel, and Jon Dufresne on https://github.com/twidi/django-decorator-include based on the original work from Jeff Kistler on https://github.com/jeffkistler/django-decorator-include.

https://badge.fury.io/py/django-decorator-include.svg https://travis-ci.org/twidi/django-decorator-include.svg?branch=develop

Installation

Assuming you have pip installed, run the following command to install from PyPI:

pip install django-decorator-include

Usage

decorator_include is intended for use in URL confs as a replacement for the django.conf.urls.include function. It works in almost the same way as include, however the first argument should be either a decorator or an iterable of decorators to apply, in reverse order, to all included views. Here is an example URL conf:

from django.urls import path
from django.contrib.auth.decorators import login_required

from decorator_include import decorator_include

from mysite.views import index

urlpatterns = [
    path('', views.index, name='index'),
    path('secret/', decorator_include(login_required, 'mysite.secret.urls')),
]

Supported versions

Django versions

Python versions

2.0

3.4, 3.5, 3.6, 3.7

2.1

3.5, 3.6, 3.7

All library versions to use for old Django/Python support

Django versions

Python versions

Library versions

1.4, 1.5

2.6, 2.7

1.2

1.6

2.6, 2.7, 3.2, 3.3

1.2

1.7

2.7, 3.2, 3.3, 3.4

1.2

1.8

2.7, 3.2, 3.3, 3.4, 3.5

1.3

1.9, 1.10

2.7, 3.4, 3.5

1.3

1.11

2.7, 3.4, 3.5, 3.6

1.4.x (>=1.4.1,<2)

2.0

3.4, 3.5, 3.6, 3.7

2.0

2.1

3.5, 3.6, 3.7

2.1

Development

Make sure you are in a virtualenv on a valid python version.

Grab the sources from Github:

git clone -b develop https://github.com/twidi/django-decorator-include.git

Then go into the newly created django-decorator-include directory and install the few needed libraries:

pip install -r requirements.txt

To run the tests, this library provides a test project, so you can launch them this way:

django-admin test --settings=tests.settings tests

Or simply launch the runtests.sh script (it will run this exact command):

./runtests.sh

Base your work on the develop branch. Iit should be the default branch on git assuming you used the -b develop argument on the git clone command as shown above.

When creating the pull request, ensure you are using the correct base (twidi/django-decorator-include on develop).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-decorator-include-2.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

django_decorator_include-2.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file django-decorator-include-2.1.tar.gz.

File metadata

  • Download URL: django-decorator-include-2.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.2

File hashes

Hashes for django-decorator-include-2.1.tar.gz
Algorithm Hash digest
SHA256 41df70c2b9bd5fe0143d01d6469c522c5e301d3e34f2df5c22a25cae798d8971
MD5 5f50a3e073a4b4fdf85f7a6db53ba222
BLAKE2b-256 60311ef72c79f66d758755280b18a6b3b95557faef22236a240225c3496b2596

See more details on using hashes here.

File details

Details for the file django_decorator_include-2.1-py3-none-any.whl.

File metadata

  • Download URL: django_decorator_include-2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.2

File hashes

Hashes for django_decorator_include-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd2d6735a6225c3836908b3cca6366e0f5b556a44a47ac92cc1f08c86fa5a3dc
MD5 31bb53b108ad640d2672c3887d2dee8f
BLAKE2b-256 1e563ca8f90efcc133effb10ecbe2df454e0714178ec086d5398b5b2c61fe744

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page