on exception return empty graph
This commit is contained in:
+13
-8
@@ -1,6 +1,7 @@
|
|||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.http import HttpResponse
|
||||||
import pytz
|
import pytz
|
||||||
from apps.transactions.models import Transaction
|
from apps.transactions.models import Transaction
|
||||||
from apps.rates.models import ExchangeRate
|
from apps.rates.models import ExchangeRate
|
||||||
@@ -45,11 +46,15 @@ def graph(request):
|
|||||||
Crypto = request.GET['crypto']
|
Crypto = request.GET['crypto']
|
||||||
Fiat = request.GET['fiat']
|
Fiat = request.GET['fiat']
|
||||||
|
|
||||||
if Crypto == "WALLET":
|
try:
|
||||||
if 'number_of_days' in request.GET:
|
if Crypto == "WALLET":
|
||||||
return Graph().wallet_graph_days(request.user.id, Fiat, request.GET['number_of_days'])
|
if 'number_of_days' in request.GET:
|
||||||
else:
|
return Graph().wallet_graph_days(request.user.id, Fiat, request.GET['number_of_days'])
|
||||||
if 'number_of_days' in request.GET:
|
else:
|
||||||
return Graph().graph_days(Crypto, Fiat, request.GET['number_of_days'])
|
if 'number_of_days' in request.GET:
|
||||||
if 'number_of_hours' in request.GET:
|
return Graph().graph_days(Crypto, Fiat, request.GET['number_of_days'])
|
||||||
return Graph().graph_hours(Crypto, Fiat, request.GET['number_of_hours'])
|
if 'number_of_hours' in request.GET:
|
||||||
|
return Graph().graph_hours(Crypto, Fiat, request.GET['number_of_hours'])
|
||||||
|
except:
|
||||||
|
response = HttpResponse(content_type = 'image/png')
|
||||||
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user