Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19306 closed Cleanup/optimization (fixed)

Docs: simple example does not work

Reported by: brycenesbitt Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Implementing 'A simple example' at
https://docs.djangoproject.com/en/dev/ref/contrib/syndication/

Gives error
Give your Entry class a get_absolute_url() method, or define an item_link() method in your Feed class.

Due to a missing 'def item_link(self, item):'

Attachments (1)

19306.diff (930 bytes) - added by Tim Graham 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by Aymeric Augustin

The example doesn't include the definition of the model; I suppose it had a get_absolute_url method.

It will be more explicit to import reverse at the beginning of the example and add something like:

    def item_link(self, item):
        return reverse('news-item', args=[item.pk])

comment:2 Changed 4 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:3 Changed 4 years ago by Claude Paroz

Also add a comment above the method telling that item_link is only needed if NewsItem has no get_absolute_url.

Changed 4 years ago by Tim Graham

Attachment: 19306.diff added

comment:4 Changed 4 years ago by Tim Graham

Has patch: set

comment:5 Changed 4 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

comment:6 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 1f1f60d12f78ee68d59b577fdb6a31857b1d0f44:

Fixed #19306 - Improved syndication example.

Thanks brycenesbitt for the report.

comment:7 Changed 4 years ago by Tim Graham <timograham@…>

In 17c61aaea303a5f21537d9978c28135f6f17b489:

[1.5.X] Fixed #19306 - Improved syndication example.

Thanks brycenesbitt for the report.

Backport of 1f1f60d12f from master

Note: See TracTickets for help on using tickets.
Back to Top