예제 #1
0
def dweet_reply(request, dweet_id):
    reply_to = get_object_or_404(Dweet, id=dweet_id)
    d = Dweet(code=request.POST['code'],
              reply_to=reply_to,
              author=request.user,
              posted=timezone.now())
    d.save()
    d.likes.add(d.author)
    d.hotness = hot(1, d.posted)
    d.save()

    new_dweet_message(request, d.id)

    return HttpResponseRedirect(
        reverse('dweet_show', kwargs={'dweet_id': d.id}))
예제 #2
0
파일: views.py 프로젝트: iver56/dwitter
def dweet_reply(request, dweet_id):
    reply_to = get_object_or_404(Dweet, id=dweet_id)
    d = Dweet(code=request.POST['code'],
              reply_to=reply_to,
              author=request.user,
              posted=timezone.now())
    d.save()
    d.likes.add(d.author)
    d.hotness = hot(1, d.posted)
    d.save()

    new_dweet_message(request, d.id)

    return HttpResponseRedirect(reverse('dweet_show',
                                kwargs={'dweet_id': d.id}))
예제 #3
0
def dweet(request):
    code = request.POST['code']

    if (len(code.replace('\r\n', '\n')) > 140):
        return HttpResponseBadRequest("Dweet code too long! Code: " + code)

    d = Dweet(code=code, author=request.user, posted=timezone.now())
    d.save()
    d.likes.add(d.author)
    d.hotness = hot(1, d.posted)
    d.save()

    new_dweet_message(request, d.id)

    return HttpResponseRedirect(
        reverse('dweet_show', kwargs={'dweet_id': d.id}))
예제 #4
0
파일: views.py 프로젝트: iver56/dwitter
def dweet(request):
    code = request.POST['code']

    if(len(code.replace('\r\n', '\n')) > 140):
        return HttpResponseBadRequest("Dweet code too long! Code: " + code)

    d = Dweet(code=code,
              author=request.user,
              posted=timezone.now())
    d.save()
    d.likes.add(d.author)
    d.hotness = hot(1, d.posted)
    d.save()

    new_dweet_message(request, d.id)

    return HttpResponseRedirect(reverse('dweet_show',
                                kwargs={'dweet_id': d.id}))