Answer the question
In order to leave comments, you need to log in
Can't display captcha in comments?
I put Google captcha through an external plugin in registration and authorization - everything works fine. I can't do the same with comments, how to add a dictionary
context = {'GOOGLE_RECAPTCHA_SITE_KEY': settings.GOOGLE_RECAPTCHA_SITE_KEY,}
def addcomment(reguest, one_id):
return_path = reguest.META.get('HTTP_REFERER', '/')
if reguest.POST and ('pause' not in reguest.session):
form = CommentForm(reguest.POST)
if form.is_valid():
comment = form.save(commit=False)
comment.comments_author = reguest.user
comment.comments_blogpost = BlogPost.objects.get(id=one_id)
form.save()
reguest.session.set_expiry(60)
reguest.session['pause'] = True
return redirect(return_path)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question