Add a random created_at date to each seed transaction

This commit is contained in:
Tanner Collin 2021-07-17 22:15:01 +00:00
parent bf34c33534
commit aa4e8ae0e2

View File

@ -1,6 +1,7 @@
from server.api.models import Transaction, Account, User, Stack
from django.core.management.base import BaseCommand
from datetime import datetime, timedelta, timezone
import sys
import itertools
import random
@ -63,6 +64,7 @@ class Command(BaseCommand):
#name='Transaction #{}'.format(tx_num),
details='Belongs to stack #{}'.format(stack_num),
amount=random.randint(1, 100),
created_at=datetime.now(timezone.utc) - timedelta(hours=random.randint(1, 4380)),
)
self.stdout.write('.')