Add a random created_at date to each seed transaction
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from server.api.models import Transaction, Account, User, Stack
|
from server.api.models import Transaction, Account, User, Stack
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
import sys
|
import sys
|
||||||
import itertools
|
import itertools
|
||||||
import random
|
import random
|
||||||
@@ -63,6 +64,7 @@ class Command(BaseCommand):
|
|||||||
#name='Transaction #{}'.format(tx_num),
|
#name='Transaction #{}'.format(tx_num),
|
||||||
details='Belongs to stack #{}'.format(stack_num),
|
details='Belongs to stack #{}'.format(stack_num),
|
||||||
amount=random.randint(1, 100),
|
amount=random.randint(1, 100),
|
||||||
|
created_at=datetime.now(timezone.utc) - timedelta(hours=random.randint(1, 4380)),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.stdout.write('.')
|
self.stdout.write('.')
|
||||||
|
Reference in New Issue
Block a user