Beispiel #1
0
def news_ajax(request): # {{{
    print(request.POST)
    idx = [1,2,4,5,9]
    params = {}
    params['news'] = News.get_news_list()
    # for i in xrange(len(params['news'])):
    for i in xrange(20):
        event_ids = params['news'][i]["event_ids"]
        params['news'][i]["result"] = Event.get_events('data/evlist_news.txt', idx=event_ids)
    return render_json_response(params)
Beispiel #2
0
def events_ajax(request): # {{{
    """ Events page """
    print(request.POST)
    month = request.POST.get("month", False)
    station = request.POST.get("station", None)
    flow = request.POST.get("flow", False)
    filter = request.POST.get("filter", False)
    from_id = request.POST.get("from_id", False)
    to_id = request.POST.get("to_id", False)
    news_id = request.POST.get("news_id", False)
    if month: month = int(month)
    if news_id: news_id = int(news_id)

    params = {}
    if flow:
        params['epg'] = Event.get_flow_events(month, filter, from_id, to_id)
    elif news_id:
        news = News.get_news_list(False)
        idx = news[news_id]['event_ids']
        params['epg'] = Event.get_events('data/evlist_news.txt', idx=idx)
        # params['epg'] = Event.get_events('data/evlist/event_1up.txt', idx=idx)
    else:
        params['epg'] = Event.get_events_by_station(month, station)[:500]
    return render_json_response(params)