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
36a231d7
Commit
36a231d7
authored
Mar 23, 2016
by
David Haynes
🙆
Browse files
Remove some duplicate code?
- yeah I have no idea where that came from - but it's ok now, I'm saving the day here
parent
6ad76dd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
go/go/forms.py
View file @
36a231d7
...
...
@@ -190,22 +190,6 @@ class SignupForm(forms.ModelForm):
self
.
add_error
(
'username'
,
"This is not your NetID!"
)
return
data_username
def
__init__
(
self
,
request
,
*
args
,
**
kwargs
):
# Necessary to call request in forms.py, is otherwise restricted to views.py and models.py
self
.
request
=
request
super
(
SignupForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
helper
=
FormHelper
(
form
=
self
)
self
.
helper
.
form_method
=
'POST'
def
clean_username
(
self
):
# Prevent hax: (non-staff) Users cannot signup for other users
cleaned_data
=
super
(
SignupForm
,
self
).
clean
()
data_username
=
cleaned_data
.
get
(
"username"
)
if
not
self
.
request
.
user
.
is_staff
:
if
self
.
request
.
user
.
username
not
in
data_username
:
self
.
add_error
(
'username'
,
"This is not your NetID!"
)
return
data_username
def
__init__
(
self
,
request
,
*
args
,
**
kwargs
):
# Necessary to call request in forms.py, is otherwise restricted to views.py and models.py
...
...
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