Commit 78630fdf authored by Rafal's avatar Rafal

Add init and init_users scripts

parent f11359f4
from django.contrib.auth.models import User
from django.core.management import call_command
__author__ = 'Rafal'
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Closes the specified poll for voting'
def add_arguments(self, parser):
parser.add_argument('poll_id', nargs='+', type=int)
def handle(self, *args, **options):
call_command('init_users')
call_command('init_localizations')
\ No newline at end of file
from django.contrib.auth.models import User
__author__ = 'Rafal'
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Closes the specified poll for voting'
def add_arguments(self, parser):
parser.add_argument('poll_id', nargs='+', type=int)
def handle(self, *args, **options):
users = [
['admin', 'admin', 'admin@gmail.com', ],
['Antek', 'Antek', 'antek@gmail.com'],
['Rafal','Rafal', 'rafal@gmail.com'],
['Klaudia','Klaudia', 'klaudia@gmail.com']
]
print "Creating Users"
for user in users:
print "Create {0}".format(user[0])
new_user = User.objects.create(username=user[0], password=user[1], email=user[2],is_active=True, is_superuser=True, is_staff=True,)
new_user.set_password(user[1])
new_user.save()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment