def permission_required(permission_name):
 def test(user):
  return user.has_perm(permission_name)
 return user_passes_test(test)

def permission_required ( permission_name ) : def test ( user ) : return user . has_perm ( permission_name ) return user_passes_test ( test )
decorator for views that checks whether a user has a particular permission enabled .