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 random
from datetime import timedelta
from decimal import Decimal
from django.utils import timezone
from django.contrib.auth.models import User, Group, Permission, ContentType
@ -109,7 +110,7 @@ class Command(MyBaseCommand):
else:
account = liq_account
amount = 0
amount = Decimal('0')
at = timezone.now() - timedelta(
seconds=random.randint(0, past_date))
@ -127,13 +128,13 @@ class Command(MyBaseCommand):
ope = Operation(
group=opegroup,
type=Operation.DEPOSIT,
amount=random.randint(1, 99)/10,
amount=Decimal(random.randint(1, 99)/10,)
)
elif typevar > 0.8 and account != liq_account:
ope = Operation(
group=opegroup,
type=Operation.WITHDRAW,
amount=random.randint(1, 99)/10,
amount=Decimal(random.randint(1, 99)/10,)
)
else:
article = random.choice(articles)