Private
Public Access
1
0

implemented comments page

This commit is contained in:
Sander Roosendaal
2017-02-17 16:13:34 +01:00
parent 7ffaf18379
commit 53f51c456f
6 changed files with 455 additions and 174 deletions

View File

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