I Implemented the comments framework yesterday and it’s all working great. However I have setup a little script so I recieve emails when a comment is posted so I can publish the comment if I wish to. However last night I recieved about 20 spam emails from a bot that had been onto the page. I’ve checked Google Analytics and yesterday I had 28 page views and 6 unique views. So it looks like 1 or 2 bots and have filled in the form numerous times.
When I view the source code on the site the ‘honey pot’ field is there so i’m not sure why that is caputuring the spam. I’m wondering whether i’m missing something in my code for the honey pot / spam filter to work?
Here is all the code for my form, i’m fairly new to Django no it could be i’ve missed anything. I don’t see the reason in implementing a third party spam filter as the traffic on the site isn’t that high.
///FORM
{% get_comment_form for notice as form %}
<div id="comment_wrap">
<h1>Comments</h1>
{% get_comment_list for notice as comment_list %}
{% get_comment_count for notice as comment_count %}
<h2>{{comment_count}} comment{{ comment_count|pluralize:"s"}}</h2>
<form action="{% comment_form_target %}" method="post">
<table>
<tr>
<td>
{{ form.comment.errors }}
<div class="add">
<textarea id="id_comment" name="comment" value="Add a comment...">Add a comment...</textarea></div>
</td>
</tr>
</table>
<table>
<tr>
{{ form.non_field_errors }}
<td height="30">
{{ form.name.errors }}
<div class="name"><input id="id_name" type="text" maxlength="50" name="name" value="Name"></div>
</td>
<td>
{{ form.company.errors }}
<div class="company">
<input type="text" maxlength="50" name="company" id="id_company" value="Company">
</div>
</td>
<input type="hidden" name="url" value="http://www.website.org" />
<input type="hidden" name="email" value="email@email.com" />
<td>
<input type="hidden" name="next" value="{{notice.get_absolute_url}}#commentmade"/>
<button class="submit" value="Submit" >Submit</button>
</td>
</tr>
</table>
<div id="commentmade" style="display: none;"><p>Thanks for posting. Your comment is awaiting approval.</p></div>
<div class="fieldWrapper honey_pot">
{{ form.honeypot.errors }}
<label for="id_honeypot">If you enter anything in this field your comment will be treated as spam:</label>
{{ form.honeypot }}
{{ form.content_type.errors }}
{{ form.content_type }}
{{ form.object_pk.errors }}
{{ form.object_pk }}
{{ form.timestamp.errors }}
{{ form.timestamp }}
{{ form.security_hash.errors }}
{{ form.security_hash }}
</div>
</form>
</div>
{% for comment in comment_list reversed %}
<div id="comment_post">
<span class="name">{{comment.user_name}}</span>
<span class="company"> | {{comment.company}} | </span>
<span class="time">{{comment.submit_date|timesince}}</span>
<p>{{comment.comment}}</p>
</div>
{% endfor %}
honeypot is just a hidden filled, that is likely to be filled by a bot and not by a real user.
When honeypot has a value, then the form doesn’t validate.
Maybe a solution like Akismet, integrated in django-akismet for example, would help you more.