Showing
5 changed files
with
22 additions
and
22 deletions
| @@ -4,9 +4,9 @@ Customizing the comments framework | @@ -4,9 +4,9 @@ Customizing the comments framework | ||
| 4 | 4 | ||
| 5 | .. currentmodule:: django_comments | 5 | .. currentmodule:: django_comments |
| 6 | 6 | ||
| 7 | -If the built-in comment framework doesn't quite fit your needs, you can extend | 7 | +If the comment framework doesn't quite fit your needs, you can extend |
| 8 | the comment app's behavior to add custom data and logic. The comments framework | 8 | the comment app's behavior to add custom data and logic. The comments framework |
| 9 | -lets you extend the built-in comment model, the built-in comment form, and the | 9 | +lets you extend the in comment model, the comment form, and the |
| 10 | various comment views. | 10 | various comment views. |
| 11 | 11 | ||
| 12 | The :setting:`COMMENTS_APP` setting is where this customization begins. Set | 12 | The :setting:`COMMENTS_APP` setting is where this customization begins. Set |
| @@ -35,8 +35,8 @@ An example custom comments app | @@ -35,8 +35,8 @@ An example custom comments app | ||
| 35 | ============================== | 35 | ============================== |
| 36 | 36 | ||
| 37 | One of the most common types of customization is modifying the set of fields | 37 | One of the most common types of customization is modifying the set of fields |
| 38 | -provided on the built-in comment model. For example, some sites that allow | ||
| 39 | -comments want the commentator to provide a title for their comment; the built-in | 38 | +provided on the comment model. For example, some sites that allow |
| 39 | +comments want the commentator to provide a title for their comment; the | ||
| 40 | comment model has no field for that title. | 40 | comment model has no field for that title. |
| 41 | 41 | ||
| 42 | To make this kind of customization, we'll need to do three things: | 42 | To make this kind of customization, we'll need to do three things: |
| @@ -87,7 +87,7 @@ field:: | @@ -87,7 +87,7 @@ field:: | ||
| 87 | title = forms.CharField(max_length=300) | 87 | title = forms.CharField(max_length=300) |
| 88 | 88 | ||
| 89 | def get_comment_model(self): | 89 | def get_comment_model(self): |
| 90 | - # Use our custom comment model instead of the built-in one. | 90 | + # Use our custom comment model instead of the default one. |
| 91 | return CommentWithTitle | 91 | return CommentWithTitle |
| 92 | 92 | ||
| 93 | def get_comment_create_data(self): | 93 | def get_comment_create_data(self): |
| @@ -164,7 +164,7 @@ however. | @@ -164,7 +164,7 @@ however. | ||
| 164 | spam-prevention features (see | 164 | spam-prevention features (see |
| 165 | :ref:`notes-on-the-comment-form`). If replacing it with your | 165 | :ref:`notes-on-the-comment-form`). If replacing it with your |
| 166 | own form, you may want to look at the source code for the | 166 | own form, you may want to look at the source code for the |
| 167 | - built-in form and consider incorporating similar features. | 167 | + default form and consider incorporating similar features. |
| 168 | 168 | ||
| 169 | .. function:: get_form_target() | 169 | .. function:: get_form_target() |
| 170 | 170 |
| 1 | .. highlightlang:: html+django | 1 | .. highlightlang:: html+django |
| 2 | 2 | ||
| 3 | -=========================================== | ||
| 4 | -Example of using the built-in comments app | ||
| 5 | -=========================================== | 3 | +================================= |
| 4 | +Example of using the comments app | ||
| 5 | +================================= | ||
| 6 | 6 | ||
| 7 | Follow the first three steps of the :doc:`quick start guide <quickstart>`. | 7 | Follow the first three steps of the :doc:`quick start guide <quickstart>`. |
| 8 | 8 | ||
| @@ -158,7 +158,7 @@ Moderation | @@ -158,7 +158,7 @@ Moderation | ||
| 158 | 158 | ||
| 159 | Now that we have the comments framework working, we might want to have some | 159 | Now that we have the comments framework working, we might want to have some |
| 160 | moderation setup to administer the comments. The comments framework comes | 160 | moderation setup to administer the comments. The comments framework comes |
| 161 | -built-in with :doc:`generic comment moderation | 161 | +with :doc:`generic comment moderation |
| 162 | <moderation>`. The comment moderation has the following | 162 | <moderation>`. The comment moderation has the following |
| 163 | features (all of which or only certain can be enabled): | 163 | features (all of which or only certain can be enabled): |
| 164 | 164 |
| @@ -3,7 +3,7 @@ Comment form classes | @@ -3,7 +3,7 @@ Comment form classes | ||
| 3 | ==================== | 3 | ==================== |
| 4 | 4 | ||
| 5 | .. module:: django_comments.forms | 5 | .. module:: django_comments.forms |
| 6 | - :synopsis: Forms for dealing with the built-in comment model. | 6 | + :synopsis: Forms for dealing with the comment model. |
| 7 | 7 | ||
| 8 | The ``django.contrib.comments.forms`` module contains a handful of forms | 8 | The ``django.contrib.comments.forms`` module contains a handful of forms |
| 9 | you'll use when writing custom views dealing with comments, or when writing | 9 | you'll use when writing custom views dealing with comments, or when writing |
| @@ -11,11 +11,11 @@ you'll use when writing custom views dealing with comments, or when writing | @@ -11,11 +11,11 @@ you'll use when writing custom views dealing with comments, or when writing | ||
| 11 | 11 | ||
| 12 | .. class:: CommentForm | 12 | .. class:: CommentForm |
| 13 | 13 | ||
| 14 | - The main comment form representing the standard, built-in way of handling | 14 | + The main comment form representing the standard way of handling |
| 15 | submitted comments. This is the class used by all the views | 15 | submitted comments. This is the class used by all the views |
| 16 | :mod:`django_comments` to handle submitted comments. | 16 | :mod:`django_comments` to handle submitted comments. |
| 17 | 17 | ||
| 18 | - If you want to build custom views that are similar to Django's built-in | 18 | + If you want to build custom views that are similar to django_comment's built-in |
| 19 | comment handling views, you'll probably want to use this form. | 19 | comment handling views, you'll probably want to use this form. |
| 20 | 20 | ||
| 21 | Abstract comment forms for custom comment apps | 21 | Abstract comment forms for custom comment apps |
| 1 | -=========================== | ||
| 2 | -The built-in comment models | ||
| 3 | -=========================== | 1 | +================== |
| 2 | +The comment models | ||
| 3 | +================== | ||
| 4 | 4 | ||
| 5 | .. module:: django_comments.models | 5 | .. module:: django_comments.models |
| 6 | - :synopsis: The built-in comment models | 6 | + :synopsis: The comment models |
| 7 | 7 | ||
| 8 | .. class:: Comment | 8 | .. class:: Comment |
| 9 | 9 | ||
| 10 | - Django's built-in comment model. Has the following fields: | 10 | + The comment model. Has the following fields: |
| 11 | 11 | ||
| 12 | .. attribute:: content_object | 12 | .. attribute:: content_object |
| 13 | 13 |
| @@ -67,14 +67,14 @@ knows how to work with them to determine whether to allow a comment, whether | @@ -67,14 +67,14 @@ knows how to work with them to determine whether to allow a comment, whether | ||
| 67 | to moderate a comment which will be allowed to post, and whether to email | 67 | to moderate a comment which will be allowed to post, and whether to email |
| 68 | notifications of new comments. | 68 | notifications of new comments. |
| 69 | 69 | ||
| 70 | -Built-in moderation options | ||
| 71 | ---------------------------- | 70 | +Moderation options |
| 71 | +------------------ | ||
| 72 | 72 | ||
| 73 | .. class:: CommentModerator | 73 | .. class:: CommentModerator |
| 74 | 74 | ||
| 75 | Most common comment-moderation needs can be handled by subclassing | 75 | Most common comment-moderation needs can be handled by subclassing |
| 76 | :class:`CommentModerator` and | 76 | :class:`CommentModerator` and |
| 77 | - changing the values of pre-defined attributes; the full range of built-in | 77 | + changing the values of pre-defined attributes; the full range of |
| 78 | options is as follows. | 78 | options is as follows. |
| 79 | 79 | ||
| 80 | .. attribute:: auto_close_field | 80 | .. attribute:: auto_close_field |
| @@ -138,7 +138,7 @@ models registered using the subclass. | @@ -138,7 +138,7 @@ models registered using the subclass. | ||
| 138 | Adding custom moderation methods | 138 | Adding custom moderation methods |
| 139 | -------------------------------- | 139 | -------------------------------- |
| 140 | 140 | ||
| 141 | -For situations where the built-in options listed above are not | 141 | +For situations where the options listed above are not |
| 142 | sufficient, subclasses of :class:`CommentModerator` can also override | 142 | sufficient, subclasses of :class:`CommentModerator` can also override |
| 143 | the methods which actually perform the moderation, and apply any logic | 143 | the methods which actually perform the moderation, and apply any logic |
| 144 | they desire. :class:`CommentModerator` defines three methods which | 144 | they desire. :class:`CommentModerator` defines three methods which |
Please
register
or
login
to post a comment