Exemplo n.º 1
0
def ajax_show_messages(request):
    page = int(request.GET.get('page', 0))
    offset = page * MESSAGES_PER_PAGE
    count = MESSAGES_PER_PAGE

    rmessages = RMessage.get_all(offset, count)

    if len(rmessages) == 0:
        raise Http404

    return_data = []
    for i in rmessages:
        m = i.__dict__
        m['date'] = _date(unix_timestamp_to_datetime(
            m['date']),
            "M j, Y \a\t H:i:s"
        )
        return_data.append(m)

    return HttpResponse(json.dumps(return_data),
                        mimetype="application/json")
Exemplo n.º 2
0
def from_unix_timestamp(value):
    return utils.unix_timestamp_to_datetime(int(value))