/docs/ref/contrib/comments/forms.txt

https://code.google.com/p/mango-py/ · Plain Text · 46 lines · 32 code · 14 blank · 0 comment · 0 complexity · 8b45fa49e6d7f4decb611ccd2df2c5db MD5 · raw file

  1. ====================
  2. Comment form classes
  3. ====================
  4. .. module:: django.contrib.comments.forms
  5. :synopsis: Forms for dealing with the built-in comment model.
  6. The ``django.contrib.comments.forms`` module contains a handful of forms
  7. you'll use when writing custom views dealing with comments, or when writing
  8. :doc:`custom comment apps </ref/contrib/comments/custom>`.
  9. .. class:: CommentForm
  10. The main comment form representing the standard, built-in way of handling
  11. submitted comments. This is the class used by all the views
  12. :mod:`django.contrib.comments` to handle submitted comments.
  13. If you want to build custom views that are similar to Django's built-in
  14. comment handling views, you'll probably want to use this form.
  15. Abstract comment forms for custom comment apps
  16. ----------------------------------------------
  17. If you're building a :doc:`custom comment app </ref/contrib/comments/custom>`,
  18. you might want to replace *some* of the form logic but still rely on parts of
  19. the existing form.
  20. :class:`CommentForm` is actually composed of a couple of abstract base class
  21. forms that you can subclass to reuse pieces of the form handling logic:
  22. .. class:: CommentSecurityForm
  23. Handles the anti-spoofing protection aspects of the comment form handling.
  24. This class contains the ``content_type`` and ``object_pk`` fields pointing
  25. to the object the comment is attached to, along with a ``timestamp`` and a
  26. ``security_hash`` of all the form data. Together, the timestamp and the
  27. security hash ensure that spammers can't "replay" form submissions and
  28. flood you with comments.
  29. .. class:: CommentDetailsForm
  30. Handles the details of the comment itself.
  31. This class contains the ``name``, ``email``, ``url``, and the ``comment``
  32. field itself, along with the associated validation logic.