def admin_required(fn):
    def wrapper(request, *args, **kwargs):
        if not request.user.is_staff:
            return redirect('c4all_admin:login_admin')
        return fn(request, *args, **kwargs)
    wrapper.__name__ = fn.__name__
    wrapper.__doc__ = fn.__doc__
    return wrapper
View decorator for checking if user is logged in and is member of staff.
dataset/ETHPy150Open c4all/c4all/admin/decorators.py/admin_required