def comment(request): ''' respond to a book review ''' form = forms.CommentForm(request.POST) # this is a bit of a formality, the form is just one text field if not form.is_valid(): return redirect('/') parent_id = request.POST['parent'] parent = models.Status.objects.get(id=parent_id) outgoing.handle_comment(request.user, parent, form.data['content']) return redirect('/')
def comment(request): ''' create a book comment ''' form = forms.CommentForm(request.POST) book_identifier = request.POST.get('book') # TODO: better failure behavior if not form.is_valid(): return redirect('/book/%s' % book_identifier) # TODO: validation, htmlification content = form.data.get('content') outgoing.handle_comment(request.user, book_identifier, content) return redirect('/book/%s' % book_identifier)