Added first files for admin and login/signup in admin
This commit is contained in:
parent
e0ed00af8c
commit
d9b62719d7
139 changed files with 18408 additions and 4 deletions
26
paramecio2/libraries/db/extrafields/moneyfield.py
Normal file
26
paramecio2/libraries/db/extrafields/moneyfield.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from paramecio2.libraries.db.corefields import FloatField
|
||||
from decimal import Decimal, getcontext
|
||||
from locale import format_string
|
||||
|
||||
getcontext().prec=2
|
||||
|
||||
class MoneyField(FloatField):
|
||||
|
||||
def __init__(self, name, required=False):
|
||||
|
||||
super().__init__(name, 11, required)
|
||||
|
||||
def check(self, value):
|
||||
|
||||
value=Decimal(value)
|
||||
|
||||
return value
|
||||
|
||||
def show_formatted(self, value):
|
||||
|
||||
return format_string('%.2f', Decimal(value), grouping=True)
|
||||
|
||||
@staticmethod
|
||||
def format_money(value):
|
||||
return format_string('%.2f', Decimal(value), grouping=True)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue