Fix in moneyfield

This commit is contained in:
Antonio de la Rosa 2021-03-01 00:45:20 +01:00
parent 0fad021034
commit 3c643f4a04
2 changed files with 8 additions and 2 deletions

View file

@ -122,6 +122,12 @@ class FloatField(PhangoField):
return 'FLOAT NOT NULL DEFAULT "0"' return 'FLOAT NOT NULL DEFAULT "0"'
class DecimalField(FloatField):
def get_type_sql(self):
return 'DECIMAL(20, 2) NOT NULL DEFAULT "0"'
class DoubleField(FloatField): class DoubleField(FloatField):
def get_type_sql(self): def get_type_sql(self):

View file

@ -1,10 +1,10 @@
from paramecio.cromosoma.corefields import FloatField from paramecio.cromosoma.corefields import DecimalField
from decimal import Decimal, getcontext from decimal import Decimal, getcontext
from locale import format_string from locale import format_string
getcontext().prec=2 getcontext().prec=2
class MoneyField(FloatField): class MoneyField(DecimalField):
def __init__(self, name, required=False): def __init__(self, name, required=False):