Created
February 1, 2014 13:49
-
-
Save tauzen/8752582 to your computer and use it in GitHub Desktop.
Example of using login_required and staff_member_required decorators with Class-based views in Django.
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, include, url | |
from django.contrib.auth.decorators import login_required | |
from django.contrib.admin.views.decorators import staff_member_required | |
from django.contrib import admin | |
from application.views import ApplicationFormView, ApplicationListView | |
admin.autodiscover() | |
urlpatterns = patterns('', | |
url(r'^$', login_required(ApplicationFormView.as_view())), | |
url(r'^applist/', staff_member_required(ApplicationListView.as_view())), | |
url(r'^admin/', include(admin.site.urls)), | |
) |
Nice example
Thanks, boss. This helped me a lot.
Thank you so much.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank, it really help me