Ejemplo n.º 1
0
def latest(request):
    latest = logic.get_latest_attacks(10)
    dict_list = []
    for i in latest:
        dict_list.append(i.get_dict())
        
    answer = json.dumps(dict_list)
    return HttpResponse(answer)
Ejemplo n.º 2
0
def home(request):
    request.session["last_check"] = time.time()
    sync_attacks()
    
    latest = logic.get_latest_attacks(10)
    
    t = loader.get_template("index.html")
    c = RequestContext(request, {"latest" : latest})
    return HttpResponse(t.render(c))
Ejemplo n.º 3
0
def latest_debug(request):
    latest = logic.get_latest_attacks(10)
    
    html = ""
    for rep in latest:
        html += str(datetime.datetime.fromtimestamp(rep.when))
        html += " --- "
        html += rep.area.hebrew_name
        html += "<br>"
        
    return HttpResponse(html)