Django comments form validation, check if the comment is from authenticated user

Posted by Headcrab on Stack Overflow See other posts from Stack Overflow or by Headcrab
Published on 2012-10-27T10:57:04Z Indexed on 2012/10/27 11:00 UTC
Read the original article Hit count: 257

Filed under:
|

I wanted to add reCaptcha to the comment form, but only for non-authenticated users.

I've created my own comments app, using reCaptcha more or less according to this post, except that I don't have any (explicit) view function to post the comment, but instead I check captcha as a part of form validation process. Everything works fine so far.

Now, how do I disable reCaptcha for a logged in user? Removing all reCaptcha-related fields in the template is no problem, but how do I validate the form, not checking captcha if the comment if from an authenticated user? Alternatively, is there a way to use two different comment form classes, depending on whether the user is authenticated or not?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-comments