forked from nk521/hackathontime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
populate.py
27 lines (23 loc) · 1.08 KB
/
populate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.contrib.auth.models import User
from hackathontime_users.models import Team, Profile
from hackathontime_main.models import Hackathon
import random
import string
alpha_numeric = string.ascii_lowercase + string.ascii_uppercase + string.digits
for x in range(50):
passs = ''.join(random.choices(alpha_numeric, k=3))
u = User.objects.create_user(username=passs + ''.join(random.choices(alpha_numeric, k=5)),
first_name=''.join(random.choices(alpha_numeric, k=10)),
last_name=''.join(random.choices(alpha_numeric, k=5)),
email=''.join(random.choices(alpha_numeric, k=10))+"@abcd.com", password=passs)
u.profile.gender = random.choice("MFO")
u.profile.bio = ''.join(
[''.join(random.choices(alpha_numeric, k=20)) for _ in range(10)])
u.profile.college = str(random.randint(1, 200))
try:
u.save()
except:
pass
with open('users_made.txt', "a") as f:
f.write(u.username+"\n")
print("Done creating 50 users")