Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
1fcb569b
Commit
1fcb569b
authored
Nov 18, 2016
by
David Haynes
Browse files
Move the function before it's called
- thanks python
parent
7dc6caba
Pipeline
#499
passed with stage
in 7 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go/views.py
View file @
1fcb569b
...
...
@@ -285,6 +285,17 @@ def redirection(request, short):
url
.
save
()
return
redirect
(
url
.
target
)
"""
Decorator function for views that checks that the user is logged in and is
a staff member, displaying the login page if necessary.
"""
def
staff_member_required
(
view_func
,
redirect_field_name
=
REDIRECT_FIELD_NAME
,
login_url
=
'/'
):
return
user_passes_test
(
lambda
u
:
u
.
is_active
and
u
.
is_staff
,
login_url
=
login_url
,
redirect_field_name
=
redirect_field_name
)(
view_func
)
"""
This view is a simplified admin panel, so that staff don't need to log in
to approve links
...
...
@@ -353,14 +364,3 @@ def useradmin(request):
'need_approval'
:
need_approval
},
)
"""
Decorator function for views that checks that the user is logged in and is
a staff member, displaying the login page if necessary.
"""
def
staff_member_required
(
view_func
,
redirect_field_name
=
REDIRECT_FIELD_NAME
,
login_url
=
'/'
):
return
user_passes_test
(
lambda
u
:
u
.
is_active
and
u
.
is_staff
,
login_url
=
login_url
,
redirect_field_name
=
redirect_field_name
)(
view_func
)
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