implemented comments page
This commit is contained in:
@@ -3327,12 +3327,23 @@ def workout_comment_view(request,id=0):
|
||||
if w.privacy == 'private' and w.user.user != request.user:
|
||||
return HttpResponseForbidden("Permission error")
|
||||
|
||||
# ok we're permitted
|
||||
# ok we're permitted
|
||||
if request.method == 'POST':
|
||||
form = WorkoutCommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
cd = form.cleaned_data
|
||||
comment = cd['comment']
|
||||
c = WorkoutComment(workout=w,user=request.user,comment=comment)
|
||||
c.save()
|
||||
|
||||
comments = WorkoutComment.objects.filter(workout=w).order_by("created")
|
||||
|
||||
form = WorkoutCommentForm()
|
||||
|
||||
return render(request,
|
||||
'workout_comments.html',
|
||||
{'workout':w,
|
||||
'comments':comments,
|
||||
'form':form,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user