1👍
Use the @staff_member_required
decorator:
from django.contrib.admin.views.decorators import staff_member_required
@staff_member_required
def my_view(request):
...
0👍
from django.contrib.auth.decorators import user_passes_test
@user_passes_test(lambda u:u.is_staff, login_url='/foo/')
def staff_view(request..):
...
- [Answer]-Logging error when syncdb
- [Answer]-Unable to access static files with NGINX, gunicorn and Django
- [Answer]-How to get header and data from Models in Python?
- [Answer]-Django flatten dictionaries in ajax get / post
Source:stackexchange.com