Fix in moneyfield
This commit is contained in:
parent
0fad021034
commit
3c643f4a04
2 changed files with 8 additions and 2 deletions
|
|
@ -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):
|
||||||
|
|
|
||||||
|
|
@ -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):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue