Exemplo n.º 1
0
def all(request):
    twitters = Twitter.all_json()
    return json_response(twitters)
Exemplo n.º 2
0
def delete(request):
    twitter_id = int(request.query.get('id'))
    t = Twitter.delete(twitter_id)
    return json_response(t.json())
Exemplo n.º 3
0
def update(request):
    form = request.json()
    twitter_id = int(form.get('id'))
    t = Twitter.update(twitter_id, form)
    return json_response(t.json())
Exemplo n.º 4
0
def add(request):
    form = request.json()
    user_id = current_user(request).id
    w = Twitter.new(form, user_id)
    return json_response(w.json())
Exemplo n.º 5
0
def all(request):
    twitter_id = int(request.query.get('twitter_id'))
    cs = Comment.find_all(twitter_id=twitter_id)
    cs_json = [c.json() for c in cs]
    return json_response(cs_json)
Exemplo n.º 6
0
def update(request):
    form = request.json()
    id = int(form.get('id'))
    t = Comment.update(id, form)
    return json_response(t.json())
Exemplo n.º 7
0
def delete(request):
    comment_id = int(request.query.get('id'))
    c = Comment.delete(comment_id)
    return json_response(c.json())
Exemplo n.º 8
0
def add(request):
    u = current_user(request)
    form = request.json()
    c = Comment.new(form, u.id)
    return json_response(c.json())