-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_bulk_users.py
55 lines (51 loc) · 1.52 KB
/
create_bulk_users.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from users.models import Boban
from dictionary.models import Word
g = lipsum.Generator()
users = []
words=[]
for i in range(100):
user = Boban(first_name='User%dFirstName' % i,
last_name='User%dLastName' % i,
email='user%[email protected]' % i,
password='hashedPasswordStringPastedHereFromStep1!',
is_active=True,
)
users.append(user)
w=g.generate_paragraph()
word= Word(user = user,word=g.dictionary[-i], definition=g.generate_paragraph())
words.append(word)
Word.objects.bulk_create(words)
#Boban.objects.bulk_create(users)
for i in range(100):
if i==0:
continue
user = Boban.objects.get(pk=i)
if not user.id:
continue
users.append(user)
w=g.generate_paragraph()
word= Word(user = user,word=g.dictionary[-i], definition=g.generate_paragraph())
word.save()
#print word.user.id
#words.append(word)
Word.objects.bulk_create(words)
#Boban.objects.bulk_create(users)
img = 'images/logo.png'
from users.models import Boban
from chapters.models import Chapter
import lipsum
g = lipsum.Generator()
for i in range(10):
if i==0:
continue
user = Boban.objects.get(pk=i)
if not user.id:
continue
w=g.generate_paragraph()
word= Chapter(creator = user,location=g.dictionary[-i], name=g.dictionary[-i] + ' Chapter', description=g.generate_paragraph())
word.cover=img
word.logo=img
word.save()
#print word.user.id
#words.append(word)
Word.objects.bulk_create(words)