Code

Opened 20 months ago

Closed 20 months ago

Last modified 20 months 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 timo 20 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 20 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 20 months ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:3 Changed 20 months ago by claudep

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

Changed 20 months ago by timo

comment:4 Changed 20 months ago by timo

  • Has patch set

comment:5 Changed 20 months ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 20 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 1f1f60d12f78ee68d59b577fdb6a31857b1d0f44:

Fixed #19306 - Improved syndication example.

Thanks brycenesbitt for the report.

comment:7 Changed 20 months 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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.