2
|
1 |
import sys
|
|
2 |
from datetime import datetime
|
|
3 |
|
|
4 |
from django.core.management.base import NoArgsCommand
|
|
5 |
|
|
6 |
from django.contrib.auth.models import User
|
|
7 |
|
|
8 |
from workshop.reg.events import create_user, create_event
|
|
9 |
|
|
10 |
def seed_db():
|
|
11 |
""" a method to seed the database with random data """
|
23
|
12 |
|
66
|
13 |
user = create_user('admin@fossee.in', 'Fossee321Python', 'Admin', 'Fossee')
|
23
|
14 |
user.is_active = True
|
|
15 |
user.is_staff = True
|
|
16 |
user.is_superuser = True
|
|
17 |
user.save()
|
|
18 |
|
|
19 |
"""
|
2
|
20 |
for i in range(20):
|
|
21 |
user = create_user('user'+str(i)+'@example.com','123456', 'User', str(i))
|
|
22 |
|
|
23 |
for i in range(5):
|
|
24 |
create_event("workshop"+str(i), "This is workshop"+str(i), datetime(2010, 4, i+4), datetime(2010, 4, i+6), user)
|
23
|
25 |
|
|
26 |
"""
|
2
|
27 |
|
|
28 |
class Command(NoArgsCommand):
|
|
29 |
|
|
30 |
def handle_noargs(self, **options):
|
|
31 |
""" Just copied the code from seed_db.py """
|
|
32 |
|
|
33 |
seed_db()
|