Include Django URL patterns with decorators (python 2.7/3.4+/django 1.11)
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.
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.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')), ]
Supported versions
Django versions |
Python versions |
---|---|
1.11 |
2.7, 3.4, 3.5, 3.6 |
2.0 |
3.4, 3.5, 3.6 |
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.1 |
2.0 |
3.4, 3.5, 3.6 |
2.0 |
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-decorator-include-1.4.1.tar.gz
.
File metadata
- Download URL: django-decorator-include-1.4.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 715d00054bcbebd5f65575a7bd97d4823c1a459ed283a8c499f5a8b25cc75099 |
|
MD5 | 9ba32d6a183550220976ebdb7abfee5f |
|
BLAKE2b-256 | 1ba5e0c06552672cb99c8dd85a9be391a29d39d9fcdbe5f2d7684392f8cd53cf |
Provenance
File details
Details for the file django_decorator_include-1.4.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_decorator_include-1.4.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5514ab61381613959b40321dc97daca3e0449b04b65dac8373534a030f1238fc |
|
MD5 | 166944a6ac778831701a837b94b0ee06 |
|
BLAKE2b-256 | 19dbca8eabaf8267a1c62b80df3a2c45d1eb182e1d01fe29dbc502c6aac03ecd |