Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
pilar
pilar-backend
Commits
df282e5c
Commit
df282e5c
authored
Mar 29, 2021
by
Azhar Difa Arnanda
Browse files
menambahkan perintah createdummydata
parent
556789f3
Pipeline
#67972
passed with stages
in 2 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api/management/commands/createdummydata.py
0 → 100644
View file @
df282e5c
from
django.core.management
import
base
from
api
import
models
from
api
import
seeds
class
Command
(
base
.
BaseCommand
):
def
handle
(
self
,
*
args
,
**
kwargs
):
user
,
status
=
models
.
User
.
objects
.
get_or_create
(
**
seeds
.
USER_DATA
)
bank_account_transfer_destination
,
status
=
models
.
BankAccountTransferDestination
.
objects
.
get_or_create
(
**
seeds
.
BANK_ACCOUNT_TRANSFER_DESTINATION
)
category
,
status
=
models
.
Category
.
objects
.
get_or_create
(
**
seeds
.
CATEGORY_DATA
)
subcategory
,
status
=
models
.
Subcategory
.
objects
.
get_or_create
(
**
dict
(
seeds
.
SUBCATEGORY_DATA
,
category
=
category
))
product
,
status
=
models
.
Product
.
objects
.
get_or_create
(
**
dict
(
seeds
.
PRODUCT_DATA
,
subcategory
=
subcategory
))
transaction
,
status
=
models
.
Transaction
.
objects
.
get_or_create
(
**
dict
(
seeds
.
TRANSACTION_DATA
,
user
=
user
))
transaction_item
,
status
=
models
.
TransactionItem
.
objects
.
get_or_create
(
**
dict
(
seeds
.
TRANSACTION_ITEM_DATA
,
transaction
=
transaction
,
product
=
product
))
program
,
status
=
models
.
Program
.
objects
.
get_or_create
(
**
seeds
.
PROGRAM_DATA
)
program_donation_pck
,
status
=
models
.
ProgramDonation
.
objects
.
get_or_create
(
**
dict
(
seeds
.
PROGRAM_DONATION_CASH_DATA
,
user
=
user
,
program
=
program
))
program_donation_dlv
,
status
=
models
.
ProgramDonation
.
objects
.
get_or_create
(
**
dict
(
seeds
.
PROGRAM_DONATION_CASH_DATA
,
user
=
user
,
program
=
program
))
batch
,
status
=
models
.
Batch
.
objects
.
get_or_create
(
**
seeds
.
BATCH_DATA
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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