Created
September 6, 2013 18:06
-
-
Save Natim/6467595 to your computer and use it in GitHub Desktop.
Example with decorator in urls.py
This file contains 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
from django.conf.urls import patterns, url | |
from django.contrib.auth.decorators import login_required | |
from django.utils.translation import ugettext_lazy as _ | |
from youproject.yourapp import views | |
people_list = login_required(views.PeopleListView.as_view()) | |
people_detail = login_required(views.PeopleDetailView.as_view()) | |
urlpatterns = patterns( | |
'', | |
url(_(r'^$'), people_list, name="people_list"), | |
url(_(r'^(?P<pk>\d+)/$'), people_detail, name="people_detail"), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting,thanks for the post :)