Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
Revue de Press
Commits
f916864f
Verified
Commit
f916864f
authored
Oct 18, 2017
by
Thibaut Broggi
Browse files
Add user to group "Padawan" on registration
parent
1486ce3e
Pipeline
#1428
passed with stages
in 1 minute and 55 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/forms.py
View file @
f916864f
from
django
import
forms
from
django.contrib.auth.models
import
Group
class
TagMultipleChoiceField
(
forms
.
ModelMultipleChoiceField
):
def
prepare_value
(
self
,
value
):
...
...
@@ -15,3 +15,9 @@ class TagMultipleChoiceField(forms.ModelMultipleChoiceField):
self
.
validate
(
value
)
self
.
run_validators
(
value
)
return
value
class
SignupForm
(
forms
.
Form
):
def
signup
(
self
,
request
,
user
):
group
=
Group
.
objects
.
get
(
name
=
'Padawan'
)
user
.
groups
.
add
(
group
)
user
.
save
()
project/settings/auth.py
View file @
f916864f
...
...
@@ -41,3 +41,4 @@ AUTH_PASSWORD_VALIDATORS = [
# Disable two steps logout
ACCOUNT_LOGOUT_ON_GET
=
True
ACCOUNT_SIGNUP_FORM_CLASS
=
"rp.forms.SignupForm"
Write
Preview
Supports
Markdown
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