use decimal

This commit is contained in:
Ludovic Stephan 2017-02-08 15:38:27 -02:00
parent b692b92f74
commit 5ea9705528

View file

@ -5,6 +5,7 @@ Crée des utilisateurs, des articles et des opérations aléatoires
import os import os
import random import random
from datetime import timedelta from datetime import timedelta
from decimal import Decimal
from django.utils import timezone from django.utils import timezone
from django.contrib.auth.models import User, Group, Permission, ContentType from django.contrib.auth.models import User, Group, Permission, ContentType
@ -109,7 +110,7 @@ class Command(MyBaseCommand):
else: else:
account = liq_account account = liq_account
amount = 0 amount = Decimal('0')
at = timezone.now() - timedelta( at = timezone.now() - timedelta(
seconds=random.randint(0, past_date)) seconds=random.randint(0, past_date))
@ -127,13 +128,13 @@ class Command(MyBaseCommand):
ope = Operation( ope = Operation(
group=opegroup, group=opegroup,
type=Operation.DEPOSIT, type=Operation.DEPOSIT,
amount=random.randint(1, 99)/10, amount=Decimal(random.randint(1, 99)/10,)
) )
elif typevar > 0.8 and account != liq_account: elif typevar > 0.8 and account != liq_account:
ope = Operation( ope = Operation(
group=opegroup, group=opegroup,
type=Operation.WITHDRAW, type=Operation.WITHDRAW,
amount=random.randint(1, 99)/10, amount=Decimal(random.randint(1, 99)/10,)
) )
else: else:
article = random.choice(articles) article = random.choice(articles)