1

我昨天实施了评论框架,一切都很好。但是,我设置了一个小脚本,以便在发布评论时收到电子邮件,因此如果我愿意,我可以发布评论。然而,昨晚我收到了大约 20 封来自该页面上的机器人的垃圾邮件。我检查了谷歌分析,昨天我有 28 个页面浏览量和 6 个独特浏览量。所以它看起来像 1 或 2 个机器人,并且已经多次填写表格。

当我在网站上查看源代码时,“蜜罐”字段就在那里,所以我不确定为什么会捕获垃圾邮件。我想知道我的代码中是否遗漏了一些内容以使蜜罐/垃圾邮件过滤器正常工作?

这是我表单的所有代码,我对 Django 还很陌生,不,我可能错过了任何东西。我看不出实施第三方垃圾邮件过滤器的原因,因为网站上的流量并不高。

///形式

{% 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 %}
4

1 回答 1

2

蜜罐只是一个隐藏的填充物,很可能是由机器人而不是真实用户填充的。

当蜜罐有值时,表单不会验证。

例如,集成在 django-akismet 中的 Akismet 之类的解决方案可能会为您提供更多帮助。

于 2012-10-26T09:53:10.500 回答