Commit d4d3ec31 authored by LEVY-FALK Hugo's avatar LEVY-FALK Hugo Committed by root


parent e837975f
......@@ -110,7 +110,11 @@ def password_change_action(u_form, user, request, req=False):
def can_create(model):
"""Decorator to check if an user can create a model. """
"""Decorator to check if an user can create a model.
It assumes that a valid user exists in the request and that the model has a
method can_create(user) which returns true if the user can create this kind
of models.
def decorator(view):
def wrapper(request,*args, **kwargs):
if not model.can_create(request.user):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment