コード例 #1
0
ファイル: views.py プロジェクト: pcsforeducation/Alfred
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)
コード例 #2
0
ファイル: views.py プロジェクト: pcsforeducation/Alfred
def trains(request):
    for train in BartStop.objects.all():
        data = train.next_routes()
        return alfred_utils.render_to_json(request, data)