Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
Diskominfo-D'Blood
Mantan Aab-D Blood
Commits
56d1d62d
Verified
Commit
56d1d62d
authored
Jun 20, 2020
by
Giovan Isa Musthofa
Browse files
[GREEN] Add seed_users management command
parent
f0688243
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/main/management/commands/seed_users.py
0 → 100644
View file @
56d1d62d
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.'
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment