Showing
10 changed files
with
94 additions
and
87 deletions
| ... | ... | @@ -16,7 +16,7 @@ import sys, os |
| 16 | 16 | # If extensions (or modules to document with autodoc) are in another directory, |
| 17 | 17 | # add these directories to sys.path here. If the directory is relative to the |
| 18 | 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
| 19 | -#sys.path.insert(0, os.path.abspath('.')) | |
| 19 | +sys.path.insert(0, os.path.abspath('.')) | |
| 20 | 20 | |
| 21 | 21 | # -- General configuration ----------------------------------------------------- |
| 22 | 22 | |
| ... | ... | @@ -25,7 +25,7 @@ import sys, os |
| 25 | 25 | |
| 26 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions |
| 27 | 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
| 28 | -extensions = ['sphinx.ext.intersphinx'] | |
| 28 | +extensions = ['sphinx.ext.intersphinx', 'extensions'] | |
| 29 | 29 | |
| 30 | 30 | # Add any paths that contain templates here, relative to this directory. |
| 31 | 31 | templates_path = ['_templates'] |
| ... | ... | @@ -37,7 +37,7 @@ source_suffix = '.txt' |
| 37 | 37 | #source_encoding = 'utf-8-sig' |
| 38 | 38 | |
| 39 | 39 | # The master toctree document. |
| 40 | -master_doc = 'newindex' | |
| 40 | +master_doc = 'index' | |
| 41 | 41 | |
| 42 | 42 | # General information about the project. |
| 43 | 43 | project = u'Django Comments' |
| ... | ... | @@ -286,4 +286,7 @@ epub_copyright = u'2013, Django Software Foundation and contributors' |
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | # Example configuration for intersphinx: refer to the Python standard library. |
| 289 | -intersphinx_mapping = {'http://docs.python.org/': None} | |
| 289 | +intersphinx_mapping = { | |
| 290 | + 'python': ('http://docs.python.org/', None), | |
| 291 | + 'django': ('http://docs.djangoproject.com/en/1.5', 'http://docs.djangoproject.com/en/1.5/_objects'), | |
| 292 | +} | ... | ... |
| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | Example of using the built-in comments app |
| 5 | 5 | =========================================== |
| 6 | 6 | |
| 7 | -Follow the first three steps of the quick start guide in the | |
| 8 | -:doc:`documentation </ref/contrib/comments/index>`. | |
| 7 | +Follow the first three steps of the :doc:`quick start guide <quickstart>`. | |
| 9 | 8 | |
| 10 | 9 | Now suppose, you have an app (``blog``) with a model (``Post``) |
| 11 | 10 | to which you want to attach comments. Let's also suppose that |
| ... | ... | @@ -82,7 +81,7 @@ It looks for the ``form.html`` under the following directories |
| 82 | 81 | Since we customize the form in the second method, we make use of another |
| 83 | 82 | tag called :ttag:`comment_form_target`. This tag on rendering gives the URL |
| 84 | 83 | where the comment form is posted. Without any :doc:`customization |
| 85 | -</ref/contrib/comments/custom>`, :ttag:`comment_form_target` evaluates to | |
| 84 | +<custom>`, :ttag:`comment_form_target` evaluates to | |
| 86 | 85 | ``/comments/post/``. We use this tag in the form's ``action`` attribute. |
| 87 | 86 | |
| 88 | 87 | The :ttag:`get_comment_form` tag renders a ``form`` for a model instance by |
| ... | ... | @@ -135,14 +134,14 @@ found under the directory structure we saw for ``form.html``. |
| 135 | 134 | Feeds |
| 136 | 135 | ===== |
| 137 | 136 | |
| 138 | -Suppose you want to export a :doc:`feed </ref/contrib/syndication>` of the | |
| 137 | +Suppose you want to export a feed__ of the | |
| 139 | 138 | latest comments, you can use the built-in ``LatestCommentFeed``. Just |
| 140 | 139 | enable it in your project's ``urls.py``: |
| 141 | 140 | |
| 142 | 141 | .. code-block:: python |
| 143 | 142 | |
| 144 | 143 | from django.conf.urls import patterns |
| 145 | - from django.contrib.comments.feeds import LatestCommentFeed | |
| 144 | + from django_comments.feeds import LatestCommentFeed | |
| 146 | 145 | |
| 147 | 146 | urlpatterns = patterns('', |
| 148 | 147 | # ... |
| ... | ... | @@ -152,6 +151,7 @@ enable it in your project's ``urls.py``: |
| 152 | 151 | |
| 153 | 152 | Now you should have the latest comment feeds being served off ``/feeds/latest/``. |
| 154 | 153 | |
| 154 | +__ https://docs.djangoproject.com/en/1.5/ref/contrib/syndication/ | |
| 155 | 155 | |
| 156 | 156 | Moderation |
| 157 | 157 | ========== |
| ... | ... | @@ -159,7 +159,7 @@ Moderation |
| 159 | 159 | Now that we have the comments framework working, we might want to have some |
| 160 | 160 | moderation setup to administer the comments. The comments framework comes |
| 161 | 161 | built-in with :doc:`generic comment moderation |
| 162 | -</ref/contrib/comments/moderation>`. The comment moderation has the following | |
| 162 | +<moderation>`. The comment moderation has the following | |
| 163 | 163 | features (all of which or only certain can be enabled): |
| 164 | 164 | |
| 165 | 165 | * Enable comments for a particular model instance. |
| ... | ... | @@ -174,8 +174,8 @@ following way: |
| 174 | 174 | |
| 175 | 175 | .. code-block:: python |
| 176 | 176 | |
| 177 | - from django.contrib.comments.moderation import CommentModerator, moderator | |
| 178 | 177 | from django.db import models |
| 178 | + from django_comments.moderation import CommentModerator, moderator | |
| 179 | 179 | |
| 180 | 180 | class Post(models.Model): |
| 181 | 181 | title = models.CharField(max_length = 255) | ... | ... |
docs/extensions.py
0 → 100644
| 1 | +def setup(app): | |
| 2 | + app.add_crossref_type( | |
| 3 | + directivename = "setting", | |
| 4 | + rolename = "setting", | |
| 5 | + indextemplate = "pair: %s; setting", | |
| 6 | + ) | |
| 7 | + app.add_crossref_type( | |
| 8 | + directivename = "templatetag", | |
| 9 | + rolename = "ttag", | |
| 10 | + indextemplate = "pair: %s; template tag" | |
| 11 | + ) | |
| 12 | + app.add_crossref_type( | |
| 13 | + directivename = "templatefilter", | |
| 14 | + rolename = "tfilter", | |
| 15 | + indextemplate = "pair: %s; template filter" | |
| 16 | + ) | ... | ... |
| ... | ... | @@ -2,30 +2,18 @@ |
| 2 | 2 | Comment form classes |
| 3 | 3 | ==================== |
| 4 | 4 | |
| 5 | -.. module:: django.contrib.comments.forms | |
| 5 | +.. module:: django_comments.forms | |
| 6 | 6 | :synopsis: Forms for dealing with the built-in comment model. |
| 7 | 7 | |
| 8 | -.. warning:: | |
| 9 | - | |
| 10 | - Django's comment framework has been deprecated and is no longer supported. | |
| 11 | - Most users will be better served with a custom solution, or a hosted | |
| 12 | - product like Disqus__. | |
| 13 | - | |
| 14 | - The code formerly known as ``django.contrib.comments`` is `still available | |
| 15 | - in an external repository`__. | |
| 16 | - | |
| 17 | - __ https://disqus.com/ | |
| 18 | - __ https://github.com/django/django-contrib-comments | |
| 19 | - | |
| 20 | 8 | The ``django.contrib.comments.forms`` module contains a handful of forms |
| 21 | 9 | you'll use when writing custom views dealing with comments, or when writing |
| 22 | -:doc:`custom comment apps </ref/contrib/comments/custom>`. | |
| 10 | +:doc:`custom comment apps <custom>`. | |
| 23 | 11 | |
| 24 | 12 | .. class:: CommentForm |
| 25 | 13 | |
| 26 | 14 | The main comment form representing the standard, built-in way of handling |
| 27 | 15 | submitted comments. This is the class used by all the views |
| 28 | - :mod:`django.contrib.comments` to handle submitted comments. | |
| 16 | + :mod:`django_comments` to handle submitted comments. | |
| 29 | 17 | |
| 30 | 18 | If you want to build custom views that are similar to Django's built-in |
| 31 | 19 | comment handling views, you'll probably want to use this form. |
| ... | ... | @@ -33,7 +21,7 @@ you'll use when writing custom views dealing with comments, or when writing |
| 33 | 21 | Abstract comment forms for custom comment apps |
| 34 | 22 | ---------------------------------------------- |
| 35 | 23 | |
| 36 | -If you're building a :doc:`custom comment app </ref/contrib/comments/custom>`, | |
| 24 | +If you're building a :doc:`custom comment app <custom>`, | |
| 37 | 25 | you might want to replace *some* of the form logic but still rely on parts of |
| 38 | 26 | the existing form. |
| 39 | 27 | ... | ... |
| ... | ... | @@ -2,21 +2,9 @@ |
| 2 | 2 | The built-in comment models |
| 3 | 3 | =========================== |
| 4 | 4 | |
| 5 | -.. module:: django.contrib.comments.models | |
| 5 | +.. module:: django_comments.models | |
| 6 | 6 | :synopsis: The built-in comment models |
| 7 | 7 | |
| 8 | -.. warning:: | |
| 9 | - | |
| 10 | - Django's comment framework has been deprecated and is no longer supported. | |
| 11 | - Most users will be better served with a custom solution, or a hosted | |
| 12 | - product like Disqus__. | |
| 13 | - | |
| 14 | - The code formerly known as ``django.contrib.comments`` is `still available | |
| 15 | - in an external repository`__. | |
| 16 | - | |
| 17 | - __ https://disqus.com/ | |
| 18 | - __ https://github.com/django/django-contrib-comments | |
| 19 | - | |
| 20 | 8 | .. class:: Comment |
| 21 | 9 | |
| 22 | 10 | Django's built-in comment model. Has the following fields: |
| ... | ... | @@ -82,7 +70,7 @@ The built-in comment models |
| 82 | 70 | .. attribute:: is_public |
| 83 | 71 | |
| 84 | 72 | ``False`` if the comment is in moderation (see |
| 85 | - :doc:`/ref/contrib/comments/moderation`); If ``True``, the comment will | |
| 73 | + :doc:`moderation`); If ``True``, the comment will | |
| 86 | 74 | be displayed on the site. |
| 87 | 75 | |
| 88 | 76 | .. attribute:: is_removed | ... | ... |
| ... | ... | @@ -2,35 +2,22 @@ |
| 2 | 2 | Generic comment moderation |
| 3 | 3 | ========================== |
| 4 | 4 | |
| 5 | -.. module:: django.contrib.comments.moderation | |
| 5 | +.. module:: django_comments.moderation | |
| 6 | 6 | :synopsis: Support for automatic comment moderation. |
| 7 | 7 | |
| 8 | -.. warning:: | |
| 9 | - | |
| 10 | - Django's comment framework has been deprecated and is no longer supported. | |
| 11 | - Most users will be better served with a custom solution, or a hosted | |
| 12 | - product like Disqus__. | |
| 13 | - | |
| 14 | - The code formerly known as ``django.contrib.comments`` is `still available | |
| 15 | - in an external repository`__. | |
| 16 | - | |
| 17 | - __ https://disqus.com/ | |
| 18 | - __ https://github.com/django/django-contrib-comments | |
| 19 | - | |
| 20 | 8 | Django's bundled comments application is extremely useful on its own, |
| 21 | 9 | but the amount of comment spam circulating on the Web today |
| 22 | 10 | essentially makes it necessary to have some sort of automatic |
| 23 | 11 | moderation system in place for any application which makes use of |
| 24 | 12 | comments. To make this easier to handle in a consistent fashion, |
| 25 | -``django.contrib.comments.moderation`` provides a generic, extensible | |
| 13 | +``django_comments.moderation`` provides a generic, extensible | |
| 26 | 14 | comment-moderation system which can be applied to any model or set of |
| 27 | 15 | models which want to make use of Django's comment system. |
| 28 | 16 | |
| 29 | - | |
| 30 | 17 | Overview |
| 31 | 18 | ======== |
| 32 | 19 | |
| 33 | -The entire system is contained within ``django.contrib.comments.moderation``, | |
| 20 | +The entire system is contained within ``django_comments.moderation``, | |
| 34 | 21 | and uses a two-step process to enable moderation for any given model: |
| 35 | 22 | |
| 36 | 23 | 1. A subclass of :class:`CommentModerator` |
| ... | ... | @@ -66,7 +53,7 @@ new comment is posted on an ``Entry``: |
| 66 | 53 | Accomplishing this is fairly straightforward and requires very little |
| 67 | 54 | code:: |
| 68 | 55 | |
| 69 | - from django.contrib.comments.moderation import CommentModerator, moderator | |
| 56 | + from django_comments.moderation import CommentModerator, moderator | |
| 70 | 57 | |
| 71 | 58 | class EntryModerator(CommentModerator): |
| 72 | 59 | email_notification = True |
| ... | ... | @@ -185,7 +172,7 @@ Registering models for moderation |
| 185 | 172 | --------------------------------- |
| 186 | 173 | |
| 187 | 174 | The moderation system, represented by |
| 188 | -``django.contrib.comments.moderation.moderator`` is an instance of the class | |
| 175 | +``django_comments.moderation.moderator`` is an instance of the class | |
| 189 | 176 | :class:`Moderator`, which allows registration and "unregistration" of models |
| 190 | 177 | via two methods: |
| 191 | 178 | |
| ... | ... | @@ -227,8 +214,8 @@ models with an instance of the subclass. |
| 227 | 214 | Determines how moderation is set up globally. The base |
| 228 | 215 | implementation in |
| 229 | 216 | :class:`Moderator` does this by |
| 230 | - attaching listeners to the :data:`~django.contrib.comments.signals.comment_will_be_posted` | |
| 231 | - and :data:`~django.contrib.comments.signals.comment_was_posted` signals from the | |
| 217 | + attaching listeners to the :data:`~django_comments.signals.comment_will_be_posted` | |
| 218 | + and :data:`~django_comments.signals.comment_was_posted` signals from the | |
| 232 | 219 | comment models. |
| 233 | 220 | |
| 234 | 221 | .. method:: pre_save_moderation(sender, comment, request, **kwargs) | ... | ... |
| ... | ... | @@ -106,8 +106,8 @@ For example:: |
| 106 | 106 | ... |
| 107 | 107 | {% endfor %} |
| 108 | 108 | |
| 109 | -This returns a list of :class:`~django.contrib.comments.models.Comment` objects; | |
| 110 | -see :doc:`the comment model documentation </ref/contrib/comments/models>` for | |
| 109 | +This returns a list of :class:`~django_comments.models.Comment` objects; | |
| 110 | +see :doc:`the comment model documentation <models>` for | |
| 111 | 111 | details. |
| 112 | 112 | |
| 113 | 113 | .. templatetag:: get_comment_permalink |
| ... | ... | @@ -195,7 +195,7 @@ Rendering a custom comment form |
| 195 | 195 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 196 | 196 | |
| 197 | 197 | If you want more control over the look and feel of the comment form, you may use |
| 198 | -:ttag:`get_comment_form` to get a :doc:`form object </topics/forms/index>` that | |
| 198 | +:ttag:`get_comment_form` to get a :class:`form object <django.forms.Form>` that | |
| 199 | 199 | you can use in the template:: |
| 200 | 200 | |
| 201 | 201 | {% get_comment_form for [object] as [varname] %} |
| ... | ... | @@ -275,7 +275,7 @@ form`_ below. |
| 275 | 275 | |
| 276 | 276 | Note that we do not need to specify the user to be associated with comments |
| 277 | 277 | submitted by authenticated users. This is possible because the :doc:`Built-in |
| 278 | -Comment Models</ref/contrib/comments/models>` that come with Django associate | |
| 278 | +Comment Models <models>` that come with Django associate | |
| 279 | 279 | comments with authenticated users by default. |
| 280 | 280 | |
| 281 | 281 | In this example, the honeypot field will still be visible to the user; you'll |
| ... | ... | @@ -317,11 +317,12 @@ should know about: |
| 317 | 317 | it with a warning field; if you use the comment form with a custom |
| 318 | 318 | template you should be sure to do the same. |
| 319 | 319 | |
| 320 | -The comments app also depends on the more general :doc:`Cross Site Request | |
| 321 | -Forgery protection </ref/contrib/csrf>` that comes with Django. As described in | |
| 320 | +The comments app also depends on the more general `Cross Site Request | |
| 321 | +Forgery protection`_ that comes with Django. As described in | |
| 322 | 322 | the documentation, it is best to use ``CsrfViewMiddleware``. However, if you |
| 323 | 323 | are not using that, you will need to use the ``csrf_protect`` decorator on any |
| 324 | 324 | views that include the comment form, in order for those views to be able to |
| 325 | 325 | output the CSRF token and cookie. |
| 326 | 326 | |
| 327 | +.. _cross site request forgery protection: https://docs.djangoproject.com/en/1.5/ref/contrib/csrf/ | |
| 327 | 328 | .. _honeypot: http://en.wikipedia.org/wiki/Honeypot_(computing) | ... | ... |
docs/settings.txt
0 → 100644
| 1 | +.. _settings-comments: | |
| 2 | + | |
| 3 | +============================================= | |
| 4 | +Settings that ``django_comments`` understands | |
| 5 | +============================================= | |
| 6 | + | |
| 7 | +.. setting:: COMMENTS_HIDE_REMOVED | |
| 8 | + | |
| 9 | +COMMENTS_HIDE_REMOVED | |
| 10 | +--------------------- | |
| 11 | + | |
| 12 | +If ``True`` (default), removed comments will be excluded from comment | |
| 13 | +lists/counts (as taken from template tags). Otherwise, the template author is | |
| 14 | +responsible for some sort of a "this comment has been removed by the site staff" | |
| 15 | +message. | |
| 16 | + | |
| 17 | +.. setting:: COMMENT_MAX_LENGTH | |
| 18 | + | |
| 19 | +COMMENT_MAX_LENGTH | |
| 20 | +------------------ | |
| 21 | + | |
| 22 | +The maximum length of the comment field, in characters. Comments longer than | |
| 23 | +this will be rejected. Defaults to 3000. | |
| 24 | + | |
| 25 | +.. setting:: COMMENTS_APP | |
| 26 | + | |
| 27 | +COMMENTS_APP | |
| 28 | +------------ | |
| 29 | + | |
| 30 | +An app which provides :doc:`customization of the comments framework | |
| 31 | +<custom>`. Use the same dotted-string notation | |
| 32 | +as in :setting:`INSTALLED_APPS`. Your custom :setting:`COMMENTS_APP` | |
| 33 | +must also be listed in :setting:`INSTALLED_APPS`. | ... | ... |
| ... | ... | @@ -2,30 +2,20 @@ |
| 2 | 2 | Signals sent by the comments app |
| 3 | 3 | ================================ |
| 4 | 4 | |
| 5 | -.. module:: django.contrib.comments.signals | |
| 5 | +.. module:: django_comments.signals | |
| 6 | 6 | :synopsis: Signals sent by the comment module. |
| 7 | 7 | |
| 8 | -.. warning:: | |
| 9 | - | |
| 10 | - Django's comment framework has been deprecated and is no longer supported. | |
| 11 | - Most users will be better served with a custom solution, or a hosted | |
| 12 | - product like Disqus__. | |
| 13 | - | |
| 14 | - The code formerly known as ``django.contrib.comments`` is `still available | |
| 15 | - in an external repository`__. | |
| 16 | - | |
| 17 | - __ https://disqus.com/ | |
| 18 | - __ https://github.com/django/django-contrib-comments | |
| 19 | - | |
| 20 | -The comment app sends a series of :doc:`signals </topics/signals>` to allow for | |
| 21 | -comment moderation and similar activities. See :doc:`the introduction to signals | |
| 22 | -</topics/signals>` for information about how to register for and receive these | |
| 8 | +The comment app sends a series of signals_ to allow for | |
| 9 | +comment moderation and similar activities. See `the introduction to signals`_ for information about how to register for and receive these | |
| 23 | 10 | signals. |
| 24 | 11 | |
| 12 | +.. _signals: https://docs.djangoproject.com/en/1.5/topics/signals/ | |
| 13 | +.. _the introduction to signals: signals_ | |
| 14 | + | |
| 25 | 15 | comment_will_be_posted |
| 26 | 16 | ====================== |
| 27 | 17 | |
| 28 | -.. data:: django.contrib.comments.signals.comment_will_be_posted | |
| 18 | +.. data:: django_comments.signals.comment_will_be_posted | |
| 29 | 19 | :module: |
| 30 | 20 | |
| 31 | 21 | Sent just before a comment will be saved, after it's been sanity checked and |
| ... | ... | @@ -54,7 +44,7 @@ Arguments sent with this signal: |
| 54 | 44 | comment_was_posted |
| 55 | 45 | ================== |
| 56 | 46 | |
| 57 | -.. data:: django.contrib.comments.signals.comment_was_posted | |
| 47 | +.. data:: django_comments.signals.comment_was_posted | |
| 58 | 48 | :module: |
| 59 | 49 | |
| 60 | 50 | Sent just after the comment is saved. |
| ... | ... | @@ -75,7 +65,7 @@ Arguments sent with this signal: |
| 75 | 65 | comment_was_flagged |
| 76 | 66 | =================== |
| 77 | 67 | |
| 78 | -.. data:: django.contrib.comments.signals.comment_was_flagged | |
| 68 | +.. data:: django_comments.signals.comment_was_flagged | |
| 79 | 69 | :module: |
| 80 | 70 | |
| 81 | 71 | Sent after a comment was "flagged" in some way. Check the flag to see if this |
| ... | ... | @@ -93,7 +83,7 @@ Arguments sent with this signal: |
| 93 | 83 | :meth:`~django.db.models.Model.save` again. |
| 94 | 84 | |
| 95 | 85 | ``flag`` |
| 96 | - The ``django.contrib.comments.models.CommentFlag`` that's been attached to | |
| 86 | + The ``django_comments.models.CommentFlag`` that's been attached to | |
| 97 | 87 | the comment. |
| 98 | 88 | |
| 99 | 89 | ``created`` | ... | ... |
Please
register
or
login
to post a comment