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