Missing content_type or object_pk field 解决方案

comments/form.html 中设置如下代码


{% load comments i18n %}
{% if user.is_authenticated %}
  <form action="/comments/post/" method="post">{% csrf_token %}
  {{form.content_type}}{{form.object_pk}}{{form.timestamp}}{{form.security_hash}}
    <p><label>Post a comment:</label><br />
    <textarea name="comment" rows="10" cols="60"></textarea></p>
   <input type="submit" name="post" value="submit comment" />
  
  </form>
{% else %}
  <p>Please <a href="/login/">log in</a> to post comments.</p>
{% endif %}


你可能感兴趣的:(Missing content_type or object_pk field 解决方案)