Created
May 20, 2017 17:15
-
-
Save dhilst/0c02ed32e1daf04936262268d69bd2ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create your views here. | |
urlpatterns = [] | |
def route(regex, kwargs=None, name=None): | |
from django.conf.urls import url | |
def decorator(view): | |
urlpatterns.append(url(regex, view, kwargs, name)) | |
def wrapper(*args, **kwargs): | |
return view(*args, **kwargs) | |
return wrapper | |
return decorator | |
@route(r'^(?P<greeting>\w+)') | |
def index(req, greeting): | |
return HttpResponse('Hello ' + greeting) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In urls.py do