def get(self, request, *args, **kwargs): api = Api(2014) data = { "elapsed_time": api.get_elapsed_time(), "population": intWith(" ", api.get_estimated_population()), "success": True, } response = HttpResponse(json.dumps(data), content_type="application/json") return response
def get_context_data(self, **kwargs): ctx = super(IndexView, self).get_context_data(*kwargs) api = Api(2014) ctx["population_initial"] = intWith(" ", POPULATION) ctx["elapsed_time"] = api.get_elapsed_time() return ctx