示例#1
0
def calculator(request):
  timezone.activate(pytz.timezone("America/Argentina/Buenos_Aires"))
  max_sources = map(convDolar, maxSources())
  max_currencies = map(convCurr, maxCurrencies())
  max_currencies.sort(key=itemgetter('code'))
  all_sources = map(lambda x: {"name":x.source, "description":x.description},Source.objects.all())
  context = { 'max_sources': json.dumps(max_sources, cls=DecimalEncoder),
              'all_sources': json.dumps(all_sources),
              'max_currencies': json.dumps(max_currencies, cls=DecimalEncoder) }

  return render(request, 'calculator.html', context)
示例#2
0
文件: api.py 项目: sicarul/bluelytics
def all_currencies(request):
  max_currencies = map(convCurr, maxCurrencies())
  max_currencies.sort(key=itemgetter('code'))

  return HttpResponse(json.dumps(max_currencies, cls=DecimalEncoder), mimetype="application/json")