Fakultas Ilmu Komputer UI

Verified Commit 56d1d62d authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[GREEN] Add seed_users management command

parent f0688243
from django.core.management.base import BaseCommand
from ...factories import UserFactory
class Command(BaseCommand):
help = 'Seeds 100 users.'
def add_arguments(self, parser):
parser.add_argument('--size', default=100, type=int)
def handle(self, *args, **options):
size = abs(options['size'])
for _ in range(size):
u = UserFactory()
u.save()
self.stdout.write(self.style.SUCCESS(f'Successfully seeds {size} users.'))
Supports Markdown
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