def get_currency_precision(currency):
 cache_key = (u'currency_precision:' + currency)
 precision = cache.get(cache_key)
 if (precision is None):
  currency_obj = Currency.objects.filter(code=currency).first()
  precision = ((decimal.Decimal(u'0.1') ** currency_obj.decimal_places) if currency_obj else None)
  cache.set(cache_key, precision)
 return precision

def get_currency_precision ( currency ) : cache_key = ( u'currency_precision:' + currency ) precision = cache . get ( cache_key ) if ( precision is None ) : currency_obj = Currency . objects . filter ( code = currency ) . first ( ) precision = ( ( decimal . Decimal ( u'0.1' ) ** currency_obj . decimal_places ) if currency_obj else None ) cache . set ( cache_key , precision ) return precision
get precision by currency code .