~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to docs/ref/contrib/comments/example.txt

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
   {% get_comment_count for entry as comment_count %}
38
38
   <p>{{ comment_count }} comments have been posted.</p>
39
39
 
40
 
.. versionadded:: 1.2
41
 
 
42
40
Next, we can use the :ttag:`render_comment_list` tag, to render all comments
43
41
to the given instance (``entry``) by using the ``comments/list.html`` template::
44
42
 
138
136
=====
139
137
 
140
138
Suppose you want to export a :doc:`feed </ref/contrib/syndication>` of the
141
 
latest comments, you can use the built-in :class:`LatestCommentFeed`. Just
 
139
latest comments, you can use the built-in ``LatestCommentFeed``. Just
142
140
enable it in your project's ``urls.py``:
143
141
 
144
142
.. code-block:: python
145
143
 
146
 
  from django.conf.urls import patterns, url, include
 
144
  from django.conf.urls import patterns
147
145
  from django.contrib.comments.feeds import LatestCommentFeed
148
146
 
149
147
  urlpatterns = patterns('',
154
152
 
155
153
Now you should have the latest comment feeds being served off ``/feeds/latest/``.
156
154
 
157
 
.. versionchanged:: 1.3
158
 
 
159
 
Prior to Django 1.3, the LatestCommentFeed was deployed using the
160
 
syndication feed view:
161
 
 
162
 
.. code-block:: python
163
 
 
164
 
    from django.conf.urls import patterns
165
 
    from django.contrib.comments.feeds import LatestCommentFeed
166
 
 
167
 
    feeds = {
168
 
        'latest': LatestCommentFeed,
169
 
    }
170
 
 
171
 
    urlpatterns = patterns('',
172
 
    # ...
173
 
        (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
174
 
            {'feed_dict': feeds}),
175
 
    # ...
176
 
    )
177
 
 
178
155
 
179
156
Moderation
180
157
==========
189
166
* Close comments after a particular (user-defined) number of days.
190
167
* Email new comments to the site-staff.
191
168
 
192
 
To enable comment moderation, we subclass the :class:`CommentModerator` and
 
169
To enable comment moderation, we subclass the ``CommentModerator`` and
193
170
register it with the moderation features we want. Let's suppose we want to
194
171
close comments after 7 days of posting and also send out an email to the
195
172
site staff. In ``blog/models.py``, we register a comment moderator in the