seed file data jut needs to be linked somehow

This commit is contained in:
Elijah Lucian 2021-07-15 23:17:26 -06:00
parent 4cfdd5a677
commit fbabf850f2

View File

@ -8,6 +8,7 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
self.stdout.write('clearing and seeding database...') self.stdout.write('clearing and seeding database...')
# create test users
User.objects.all().delete() User.objects.all().delete()
elijah = User(username="elijah", elijah = User(username="elijah",
email="elijah@westwinds.io", email="elijah@westwinds.io",
@ -22,19 +23,27 @@ class Command(BaseCommand):
self.stdout.write(str(User.objects.all())) self.stdout.write(str(User.objects.all()))
self.stdout.write('Users Created!') self.stdout.write('Users Created!')
# create an account that all 3 users are attached to
Account.objects.all().delete() Account.objects.all().delete()
home = Account(name="home", details="home stacks", home = Account(name="home", details="home stacks",
income=4000, expenses=2000).save() income=4000, expenses=2000).save()
self.stdout.write(str(Account.objects.all())) self.stdout.write(str(Account.objects.all()))
self.stdout.write('Accounts Created!') self.stdout.write('Accounts Created!')
# create seed accounts
# Home Account # create test stacks for account
# $3000
# - home expenses
Stack.objects.all().delete() Stack.objects.all().delete()
# create test stacks groceries = Stack(name="Groceries",
# - name: shit details="",
amount=800).save()
takeout = Stack(name="Date Nights",
details="",
amount=400).save()
shit = Stack(name="Crap",
details="",
amount=500).save()
Transaction.objects.all().delete() Transaction.objects.all().delete()
# generate transaction history # generate transaction history