Skip to main content

Include Django URL patterns with decorators.

Project description

Include Django URL patterns with decorators.

Maintained by Twidi, on https://github.com/twidi/django-decorator-include based on the original work from Jeff Kistler on https://github.com/jeffkistler/django-decorator-include.

Installation

Installation from Source

Unpack the archive, cd to the source directory, and run the following command:

python setup.py install

Installation with pip

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

pip install django-decorator-include

Installation with pip and git

Assuming you have pip and git installed, run the following command to install from the GitHub repository:

pip install git+git://github.com/twidi/django-decorator-include.git#egg=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.conf.urls import url
from django.contrib.auth.decorators import login_required

from decorator_include import decorator_include

urlpatterns = [
    url(r'^$', 'mysite.views.index', name='index'),
    url(r'^secret/', decorator_include(login_required, 'mysite.secret.urls')),
]

Running tests

If decorator_include is in the INSTALLED_APPS of your project, and it was installed with the test (ie not from PyPI) simply run:

django-admin test decorator_include

You may want to use django-admin or ./manage.py depending on your installation.

If you are in a fresh virtualenv to work on decorator_include, install the django version you want:

pip install django

Then make the decorator_include module available in your python path. For example, with virtualenv-wrapper, considering you are at the root of the django-decorator-include repository, simply do:

add2virtualenv src

Or simply:

pip install -e .

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

DJANGO_SETTINGS_MODULE=decorator_include.tests.testproject.settings django-admin.py test decorator_include

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

./runtests.sh

Supported versions

Django version

Python versions

1.8

2.7, 3.2, 3.3, 3.4, 3.5

1.9

2.7, 3.4, 3.5

1.10

2.7, 3.4, 3.5

1.11

2.7, 3.4, 3.5, 3.6

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-1.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

django_decorator_include-1.3-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for django-decorator-include-1.3.tar.gz
Algorithm Hash digest
SHA256 2dcbbb028723f242f2280d7c475cce59b69db967722ed80ccc9dc7729ca2e802
MD5 4fc753b93f6add719c72b4f66c20330a
BLAKE2b-256 ebc89212d5083e822e67d8ba27f75c86b8a635a4f08005089dd1b684ba12d72a

See more details on using hashes here.

Provenance

File details

Details for the file django_decorator_include-1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_decorator_include-1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fd172a88de1dd38e19ddb0d91525ab7240139a3b11687bf1ea2eb775549fd073
MD5 884f9eb0858bc91dbdc25ed421017121
BLAKE2b-256 f50616291535983b532988eee1df26aba3d8e86794adf8d2fef60642a15d44a3

See more details on using hashes here.

Provenance

Supported by

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