This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_currency(value, currency, add_symbol=False): | |
# Check if value exists | |
if value: | |
# stores the negative symbol | |
symbol = "" | |
formatted_currency = "" | |
dec = "" | |
value = str(value) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.ext.declarative import DeclarativeMeta | |
class AlchemyEncoder(json.JSONEncoder): | |
def default(self, obj): | |
print obj.__public__ | |
if isinstance(obj.__class__, DeclarativeMeta): | |
fields = {} | |
for field in [x for x in obj.__public__) if not x.startswith('_') and x != 'metadata']: |