-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_data.py
351 lines (335 loc) · 7.06 KB
/
sample_data.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#from __future__ import unicode_literals
import re
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse, Http404,HttpResponseRedirect, JsonResponse
from main.models import CustomUser, Team, Sport
from django.contrib.auth import authenticate, login, logout
from django.contrib import auth
from django.views.generic import View, ListView, FormView
from django.views import generic
from register.forms import LoginForm, TeamForm, PlayerForm
from django.db import IntegrityError
from django.contrib.auth.models import User
import json
from django.core import serializers, mail
from django.contrib.auth.decorators import login_required
from django.dispatch import receiver
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.template.loader import render_to_string
from register.tokens import account_activation_token
from django.core.mail import EmailMessage
from django.core import serializers
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth import get_user_model
User=get_user_model()
from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from main.models import Group,Regplayer,Enteredplayer
from django.contrib.auth import logout
from django.contrib.auth.models import User
import json
from django.contrib.auth import get_user_model
import string
import random
from django.core import serializers
import pusher
from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from django.contrib.auth.decorators import login_required, user_passes_test
import re
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse, Http404,HttpResponseRedirect, JsonResponse
from main.models import CustomUser, Team
from django.contrib.auth import authenticate, login, logout
from django.contrib import auth
from django.views.generic import View, ListView, FormView
from django.views import generic
from register.forms import LoginForm, TeamForm, PlayerForm
from django.db import IntegrityError
from django.contrib.auth.models import User
import json
from django.core import serializers, mail
from django.contrib.auth.decorators import login_required
from django.dispatch import receiver
from random import choice
from string import ascii_uppercase
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.template.loader import render_to_string
from register.tokens import account_activation_token
from django.core.mail import EmailMessage
from django.core import serializers
from main.models import Group,Regplayer,Enteredplayer,Sport
from django.contrib.auth import get_user_model
User=get_user_model()
def name_generator(size=5, chars=string.ascii_uppercase + string.digits):
str = ''.join(random.choice(chars) for _ in range(size))
for grp in User.objects.all():
if grp.username == str:
str = name_generator()
return str
def replaceindex(text,index=0,replacement=''):
return '%s%s%s'%(text[:index],replacement,text[index+1:])
array = ['Abbott',
'Acevedo',
'Acosta',
'Adams',
'Adkins',
'Aguilar',
'Aguirre',
'Albert',
'Alexander',
'Alford',
'Allen',
'Allison',
'Alston',
'Alvarado',
'Alvarez',
'Anderson',
'Andrews',
'Anthony',
'Armstrong',
'Arnold',
'Ashley',
'Atkins',
'Atkinson',
'Austin',
'Avery',
'Avila',
'Ayala',
'Ayers',
'Bailey',
'Baird',
'Baker',
'Baldwin',
'Ball',
'Ballard',
'Banks',
'Barber',
'Barker',
'Barlow',
'Barnes',
'Barnett',
'Barr',
'Barrera',
'Barrett',
'Barron',
'Barry',
'Bartlett',
'Barton',
'Bass',
'Bates',
'Battle',
'Bauer',
'Baxter',
'Beach',
'Bean',
'Beard',
'Beasley',
'Beck',
'Becker',
'Bell',
'Bender',
'Benjamin',
'Bennett',
'Benson',
'Bentley',
'Benton',
'Berg',
'Berger',
'Bernard',
'Berry',
'Best',
'Bird',
'Bishop',
'Black',
'Blackburn',
'Blackwell',
'Blair',
'Blake',
'Blanchard',
'Blankenship',
'Blevins',
'Bolton',
'Bond',
'Bonner',
'Booker',
'Boone',
'Booth',
'Bowen',
'Bowers',
'Bowman',
'Boyd',
'Boyer',
'Boyle',
'Bradford',
'Bradley',
'Bradshaw',
'Brady',
'Branch',
'Bray',
'Brennan',
'Brewer',
'Bridges',
'Briggs',
'Bright',
'Britt',
'Brock',
'Brooks',
'Brown',
'Browning',
'Bruce',
'Bryan',
'Bryant',
'Buchanan',
'Buck',
'Buckley',
'Buckner',
'Bullock',
'Burch',
'Burgess',
'Burke',
'Burks',
'Burnett',
'Burns',
'Burris',
'Burt',
'Burton',
'Bush',
'Butler',
'Byers',
'Byrd',
'Cabrera',
'Cain',
'Calderon',
'Caldwell',
'Calhoun',
'Callahan',
'Camacho',
'Cameron',
'Campbell',
'Campos',
'Cannon',
'Cantrell',
'Cantu',
'Cardenas',
'Carey',
'Carlson',
'Carney',
'Carpenter',
'Carr',
'Carrillo',
'Carroll',
'Carson',
'Carter',
'Carver',
'Case',
'Casey',
'Cash',
'Castaneda',
'Castillo',
'Castro',
'Cervantes',
'Chambers',
'Chan',
'Chandler',
'Chaney',
'Chang',
'Chapman',
'Charles',
'Chase',
'Chavez',
'Chen',
'Cherry',
'Christensen',
'Christian',
'Church',
'Clark',
'Clarke',
'Clay',
'Clayton',
'Clements',
'Clemons',
'Cleveland',
'Cline',
'Cobb',
'Cochran',
'Coffey',
'Cohen',
'Cole',
'Coleman',
'Collier',
'Collins',
'Colon',
'Combs',
'Compton',
'Conley',
'Conner',
'Conrad',
'Contreras',
'Conway',
'Cook',
'Cooke',
'Cooley',
'Cooper',
'Copeland',
'Cortez',
'Cote',
'Cotton',
'Cox',
'Craft',
'Craig',
'Crane',
'Crawford',
'Crosby',
'Cross',
'Cruz',
'Cummings',
'Cunningham',
'Curry',
'Curtis',
'Dale',
'Dalton',
'Daniel',
'Daniels',
'Daugherty',
'Davenport',
'David',
'Davidson']
for i in range(0,60):
us = User()
us.username = array[i+90]
us.set_password(array[i+90]+"007")
us.name = array[i+90]
us.confirm1 = 2
us.sportid = replaceindex(us.sportid,i%4,'2')
us.gender = "Male"
us.team = Team.objects.get(pk=(18+i%5))
us.save()
rp = Regplayer()
rp.name = us
rp.gender = us.gender
rp.college = us.team.college
rp.city = us.team.city
rp.sport=''
for s in Sport.objects.all():
if us.sportid[s.idno]=='2':
rp.sport=rp.sport+s.sport+','
rp.save()