According robots my website rocks

According robots my website rocks

Published May 11, 2016 in Development, Web - Last update on May 11, 2016.

In the past week, I received a lot of positive comments on my blog, more than 1000 in 5 days. Naturally they explain what I see in mirror every morning, for example:

Have you ever thought about creating an e-book or guest authoring on other websites?
I have a blog centered on the same ideas you discuss and would
love to have you share some stories/information. I know my readers would appreciate your work.
If you're even remotely interested, feel free to send me
an e-mail.

It is the next weblog I want to focus on and now I
am a starting to assume properly about it.

What's up, just wanted to say, I loved this blog post.
It was funny. Keep on posting!

It is really heartwarming, thanks to all developer who made this bots. Unfortunately I don't accept comments from robots and the only as there's no way to say stop to all this generosity, I am obliged to block them.

Implementation

Simple problems should ever have simple solutions, and mine is django-recaptchaDjango reCAPTCHA form field/widget integration app. This project is easy to use, take a look at the README 1 minutes and it works.

My blog is powered by Zinnia and it uses django-contrib-comments for this part. After looked at old Django documentation and source code, it is pretty simple to implement:

  • Create a mycomment app with forms.py inside, subclass django_comments.forms.CommentForm and add captcha.fields.ReCaptchaField as attribute
from django_comments.forms import CommentForm as BaseCommentForm
from captcha.fields import ReCaptchaField

class CommentForm(BaseCommentForm):
    captcha = ReCaptchaField()
  • Add method get_form in mycomment/__init__.py
from mycomment.forms import CommentForm

def get_form():
    return CommentForm
  • Add parameters for configure Django Comments and reCAPTCHA
COMMENTS_APP = 'mycomment'

RECAPTCHA_PUBLIC_KEY = "AZaDZAODjdzoaInFactItIsPublicjzoadJZOAdjAJDozaj"
RECAPTCHA_PRIVATE_KEY = '1fzafooj&eojFZAFAFAndYouThinkICouldWriteItazepp"
NOCAPTCHA = True
RECAPTCHA_USE_SSL = True

That's done ! Feel free to comment if you are not a computer otherwise you'll not be able.

Comments

No comments yet.

Post your comment

Comment as . Log out.