Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
d4d3ec31
Commit
d4d3ec31
authored
Nov 28, 2017
by
LEVY-FALK Hugo
Committed by
root
Jan 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation.
parent
e837975f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
users/views.py
users/views.py
+5
-1
No files found.
users/views.py
View file @
d4d3ec31
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment