Self hosted FLOSS fitness/workout, nutrition and weight tracker
Don't test for AJAX requests, always return the JSON data
Roland Geider90eb5006e1d7
diff --git a/wger/weight/views.py b/wger/weight/views.pyindex 5563cceaa..23e7e5d31 100644--- a/wger/weight/views.py+++ b/wger/weight/views.py@@ -155,31 +155,32 @@ def overview(request):@login_requireddef get_weight_data(request):- # Process the data to pass it to the JS libraries to generate an SVG image-- if request.is_ajax():- date_min = request.GET.get('date_min', False)- date_max = request.GET.get('date_max', True)-- if date_min and date_max:- weights = WeightEntry.objects.filter(user=request.user,- creation_date__range=(date_min, date_max))- else:- weights = WeightEntry.objects.filter(user=request.user)-- chart_data = []-- for i in weights:- chart_data.append({'x': "%(month)s/%(day)s/%(year)s" % {- 'year': i.creation_date.year,- 'month': i.creation_date.month,- 'day': i.creation_date.day},- 'y': i.weight,- 'id': i.id})-- # Return the results to the server- mimetype = 'application/json'- return HttpResponse(json.dumps(chart_data), mimetype)+ '''+ Process the data to pass it to the JS libraries to generate an SVG image+ '''++ date_min = request.GET.get('date_min', False)+ date_max = request.GET.get('date_max', True)++ if date_min and date_max:+ weights = WeightEntry.objects.filter(user=request.user,+ creation_date__range=(date_min, date_max))+ else:+ weights = WeightEntry.objects.filter(user=request.user)++ chart_data = []++ for i in weights:+ chart_data.append({'x': "%(month)s/%(day)s/%(year)s" % {+ 'year': i.creation_date.year,+ 'month': i.creation_date.month,+ 'day': i.creation_date.day},+ 'y': i.weight,+ 'id': i.id})++ # Return the results to the server+ mimetype = 'application/json'+ return HttpResponse(json.dumps(chart_data), mimetype)CSV_DATE_FORMAT = (('%d.%m.%Y', 'DD.MM.YYYY (30.01.2012)'),