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}))
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}))
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}))
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}))