Source code for django.contrib.admin.views.decorators

[docs]defstaff_member_required(view_func=None,redirect_field_name=REDIRECT_FIELD_NAME,login_url='admin:login'):""" Decorator for views that checks that the user is logged in and is a staff member, redirecting to the login page if necessary. """actual_decorator=user_passes_test(lambdau:u.is_activeandu.is_staff,login_url=login_url,redirect_field_name=redirect_field_name)ifview_func:returnactual_decorator(view_func)returnactual_decorator