Created
November 23, 2016 15:01
-
-
Save chris-erickson/ade9e74b56333c91d780eb0f0082a2d1 to your computer and use it in GitHub Desktop.
A really hacky way to load a bunch of users through the shell instead of writing something more complicated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is just a really hacky way to load a bunch of users through the shell instead of writing something more complicated. | |
# Intructions: Paste it in line by line! | |
names = [ | |
["FirstName", "LastName", "[email protected]", "username", "a-password-here"], | |
["FirstName", "LastName", "[email protected]", "username", "a-password-here"], | |
] | |
FNAME = 0 | |
LNAME = 1 | |
EMAIL = 2 | |
UNAME = 3 | |
PASSW = 4 | |
GROUP_PK = 4 | |
group = Group.objects.get(pk=GROUP_PK) | |
for n in names: | |
u = User.objects.create_user(n[UNAME], email=n[EMAIL], password=n[PASSW]) | |
u.first_name = n[FNAME] | |
u.last_name = n[LNAME] | |
u.is_staff = True | |
u.save() | |
u.groups.add(group) | |
print(u.pk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment