mirror of
https://github.com/django/django.git
synced 2025-08-01 09:32:50 +00:00
Fixed #31822 -- Added support for comments URL per feed item.
The item_comments hook returns a comments URL which is then used by the feed builder.
This commit is contained in:
parent
184a6eebb0
commit
1173db4a16
5 changed files with 38 additions and 2 deletions
|
@ -889,6 +889,27 @@ This example illustrates all possible attributes and methods for a
|
|||
|
||||
item_copyright = 'Copyright (c) 2007, Sally Smith' # Hard-coded copyright notice.
|
||||
|
||||
# ITEM COMMENTS URL -- It's optional to use one of these three. This is
|
||||
# a hook that specifies how to get the URL of a page for comments for a
|
||||
# given item.
|
||||
|
||||
def item_comments(self, obj):
|
||||
"""
|
||||
Takes an item, as returned by items(), and returns the item's
|
||||
comments URL as a normal Python string.
|
||||
"""
|
||||
|
||||
def item_comments(self):
|
||||
"""
|
||||
Returns the comments URL for every item in the feed.
|
||||
"""
|
||||
|
||||
item_comments = 'https://www.example.com/comments' # Hard-coded comments URL
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
|
||||
Support for a comments URL per feed item was added through the
|
||||
``item_comments`` hook.
|
||||
|
||||
The low-level framework
|
||||
=======================
|
||||
|
|
|
@ -144,7 +144,8 @@ Minor features
|
|||
:mod:`django.contrib.syndication`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* The new ``item_comments`` hook allows specifying a comments URL per feed
|
||||
item.
|
||||
|
||||
Cache
|
||||
~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue