|
@@ -28,7 +28,7 @@ class ConfigurationRedirectView(RedirectView):
|
|
|
|
|
|
# @cache_control(max_age=7200)
|
|
# @cache_control(max_age=7200)
|
|
def subscription_count_json(request):
|
|
def subscription_count_json(request):
|
|
- output = {}
|
|
|
|
|
|
+ output = []
|
|
|
|
|
|
# Get date form url, or set default
|
|
# Get date form url, or set default
|
|
date = request.GET.get('date', datetime.date.today())
|
|
date = request.GET.get('date', datetime.date.today())
|
|
@@ -41,9 +41,13 @@ def subscription_count_json(request):
|
|
return HttpResponseServerError("Incorrect date format, should be YYYY-MM-DD")
|
|
return HttpResponseServerError("Incorrect date format, should be YYYY-MM-DD")
|
|
|
|
|
|
# Get current offer subscription
|
|
# Get current offer subscription
|
|
- offersubscriptions = OfferSubscription.objects.running(date).offer_summary()
|
|
|
|
|
|
+ offersubscriptions = list(OfferSubscription.objects.running(date).offer_summary())
|
|
for offersub in offersubscriptions:
|
|
for offersub in offersubscriptions:
|
|
- output[offersub['offer__name']] = offersub['num_subscriptions']
|
|
|
|
|
|
+ output.append({
|
|
|
|
+ 'reference' : offersub['offer__reference'],
|
|
|
|
+ 'name' : offersub['offer__name'],
|
|
|
|
+ 'subscriptions_count' : offersub['num_subscriptions']
|
|
|
|
+ })
|
|
|
|
|
|
# Return JSON
|
|
# Return JSON
|
|
- return JsonResponse(output)
|
|
|
|
|
|
+ return JsonResponse(output, safe=False)
|