Skip to content

Instantly share code, notes, and snippets.

@Natim
Created September 6, 2013 18:06
Show Gist options
  • Save Natim/6467595 to your computer and use it in GitHub Desktop.
Save Natim/6467595 to your computer and use it in GitHub Desktop.
Example with decorator in urls.py
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"),
)
@bolshoibooze
Copy link

Interesting,thanks for the post :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment