Opened 11 years ago
Closed 11 years ago
#21369 closed Bug (worksforme)
get_absolute_url() Reverse Example Doesn't Work
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Example on this page shows the following, which didn't work for me.
def get_absolute_url(self): return reverse('people.views.details', args=[str(self.id)])
Instead I was only able to get this to work:
def get_absolute_url(self): return reverse('people.views.details', kwargs={'id': self.id})
Note:
See TracTickets
for help on using tickets.
Hi,
It seems to be working for me, using the following code (in an freshly created app called
people
):In my main
urls.py
, I also have the following line:With this, I can use the "view on site" feature of the admin (which makes use of
get_absolute_url
) and it works as expected.I'm therefore closing this ticket as
worksforme
.If you have can provide steps to reproduce your issue or a more detailed error message, please reopen it.
Thanks.