def current(request): data = [] locations = list(Location.objects.filter(user=request.user.id).all()) for location in locations: weather_data = location.get_weather() weather_json = weather_data.to_json() weather_json['forecast'] = utils.get_forecast(location.location_name, units=location.unit, days=5, to_json=True) weather_json['city'] = location.location_name data.append(weather_json) return alfred_utils.render_to_json(request, data)
def trains(request): for train in BartStop.objects.all(): data = train.next_routes() return alfred_utils.render_to_json(request, data)