parent
7f42260960
commit
e0c2c839bb
6 changed files with 70 additions and 11 deletions
@ -0,0 +1 @@ |
||||
# -*- coding: utf-8 -*- |
||||
@ -0,0 +1,36 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from random import randint |
||||
|
||||
from django.conf import settings |
||||
|
||||
from django.core.management.base import BaseCommand |
||||
|
||||
from factories import models as f |
||||
from myauth.models import ConfirmEmail |
||||
|
||||
|
||||
class Command(BaseCommand): |
||||
help = 'Create dummy data' |
||||
|
||||
def add_arguments(self, parser): |
||||
parser.add_argument('--number', nargs='+', type=int, default=[1]) |
||||
|
||||
def handle(self, *args, **options): |
||||
for i in range(1, options['number'][0] + 1): |
||||
self.create_user() |
||||
|
||||
def create_user(self): |
||||
user = f.UserFactory() |
||||
confirm, created = ConfirmEmail.objects.get_or_create(user=user) |
||||
confirm.is_confirmed = True |
||||
confirm.save() |
||||
|
||||
bank_account = f.BankAccountFactory() |
||||
bank_account.company = user.profile |
||||
bank_account.save() |
||||
|
||||
lic = f.LicenseFactory() |
||||
lic.company = user.profile |
||||
lic.save() |
||||
|
||||
self.stdout.write(f'[{__name__}] User {user.pk} created.') |
||||
Loading…
Reference in new issue