B
B
blazer052017-02-09 15:03:11
Django
blazer05, 2017-02-09 15:03:11

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

to this function?
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

1 answer(s)
E
Evgeny Maltsev, 2017-02-11
@hellpirat

https://github.com/praekelt/django-recaptcha

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question