https://github.com/eduardoklosowski/django-urldecorator
Make Django URLs with decorator
https://github.com/eduardoklosowski/django-urldecorator
Last synced: 2 months ago
JSON representation
Make Django URLs with decorator
- Host: GitHub
- URL: https://github.com/eduardoklosowski/django-urldecorator
- Owner: eduardoklosowski
- License: mit
- Created: 2015-09-01T19:38:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-09T14:14:38.000Z (almost 10 years ago)
- Last Synced: 2025-02-09T19:29:08.778Z (4 months ago)
- Language: Python
- Size: 148 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Django URLDecorator
===================Make Django URLs with decorator.
Example
=======project/urls.py
---------------.. code:: python
...
urlpatterns = [
...
url(r'^yourapp/', include('yourapp.urls')),
...
]yourapp/urls.py
---------------.. code:: python
from urldecorator import URLList
urlpatterns = URLList(lazy_import='yourapp.views')
yourapp/views.py
----------------.. code:: python
from django.http import HttpResponse
from django.views.generic import View
from .urls import urlpatterns@urlpatterns.url(r'^$')
def index_view(request):
return HttpResponse('Index')@urlpatterns.url(r'^cbv/$')
class ClassBasedView(View):
def get(self, request, *args, **kwargs):
return HttpResponse('Class-based View')