Skip to content
GitLab
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
9423f034
Verified
Commit
9423f034
authored
Oct 18, 2017
by
Thibaut Broggi
Browse files
Set role "padawan" to all users
parent
f916864f
Pipeline
#1429
passed with stages
in 1 minute and 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/migrations/0018_add_groups_to_users.py
0 → 100644
View file @
9423f034
from
django.db
import
migrations
from
django.contrib.auth.models
import
Group
,
User
def
add_groups
(
apps
,
schema_editor
):
users
=
User
.
objects
.
all
()
padawanGroup
=
Group
.
objects
.
get
(
name
=
'Padawan'
)
for
user
in
users
:
user
.
groups
.
add
(
padawanGroup
)
user
.
save
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'rp'
,
'0017_groups'
),
]
operations
=
[
migrations
.
RunPython
(
add_groups
),
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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