Adds commenting

This commit is contained in:
Mouse Reeve
2020-02-17 21:39:08 -08:00
parent ff5217efd8
commit 9194b3c50d
8 changed files with 89 additions and 10 deletions

View File

@ -43,6 +43,7 @@ def home(request):
'-created_date'
)[:10]
comment_form = forms.CommentForm()
data = {
'user': request.user,
'reading': reading,
@ -50,6 +51,7 @@ def home(request):
'recent_books': recent_books,
'user_books': user_books,
'activities': activities,
'comment_form': comment_form,
}
return TemplateResponse(request, 'feed.html', data)
@ -250,6 +252,18 @@ def review(request):
return redirect('/book/%s' % book_identifier)
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('/')
review_id = request.POST['review']
parent = models.Review.objects.get(id=review_id)
outgoing.handle_comment(request.user, parent, form.data['content'])
return redirect('/')
@login_required
def follow(request):
''' follow another user, here or abroad '''