mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Documentation.
This commit is contained in:
parent
e837975fa8
commit
d4d3ec3131
1 changed files with 5 additions and 1 deletions
|
@ -110,7 +110,11 @@ def password_change_action(u_form, user, request, req=False):
|
||||||
))
|
))
|
||||||
|
|
||||||
def can_create(model):
|
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 decorator(view):
|
||||||
def wrapper(request,*args, **kwargs):
|
def wrapper(request,*args, **kwargs):
|
||||||
if not model.can_create(request.user):
|
if not model.can_create(request.user):
|
||||||
|
|
Loading…
Reference in a new issue