Django-urldecorators is a reusable Django application which allows apply view decorators and middleware components depending on requested url.
Project description
Django-urldecorators is a reusable Django application which allows apply view decorators and middleware components based on a requested URL.
This library is compatible with Django 1.4 and later. If you need to use older Django versions (which receive no security updates or bugfixes) you can install 0.4 version of django-urldecorators.
Installation and usage
Run python setup.py install or add the urldecorators module to your PYTHONPATH (or use pip or easy_install).
In urls.py file replace from django.conf.urls import * by from urldecorators import *
Pass a list of decorators and/or middleware_classes as an argument to the url function.
Example urls.py file:
from urldecorators import patterns, url, include urlpatterns = patterns('', url(r'^private/$', include('example.private.urls'), decorators=['django.contrib.auth.decorators.login_required']), url(r'^articles/$', include('example.articles.urls'), middleware_classes=['django.middleware.cache.CacheMiddleware']), )
For the example configuration and usage see the example project included in the repository. It can be run using django-admin.py utility from the repository root:
$ django-admin.py syncdb --settings=example.settings --pythonpath=$PWD $ django-admin.py runserver --settings=example.settings --pythonpath=$PWD
Testing
Application tests can be simply run using django-admin.py utility:
$ django-admin.py test --settings=urldecorators.tests.settings --pythonpath=$PWD
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
File details
Details for the file django-urldecorators-0.5.tar.gz
.
File metadata
- Download URL: django-urldecorators-0.5.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f0a9663627b00c35ff86610c76276aac80f2fab3d04c919baff3065e24f50b6 |
|
MD5 | 5bea18ead8af306f06ee5aaff9497824 |
|
BLAKE2b-256 | d8cadb96fd4e4da81621e7511cfd9c9ea723db24d18db712c66afd78ca055ecb |