Closed Belgand closed 12 years ago
Clicking on links that use this method still isn't working. I added some notes to your code to hopefully explain why. Keep in mind that this issue also depends on issue #37 and probably won't test well without resolving issue #42 (the details page is the only place I currently know of that uses this method on a tag).
This method is already being called on the todoitem_details template and it simply provides a way to get an absolute (i.e. not relative) url associated with an object. This means we can keep our code more loosely coupled. That way if we want to change what url it points to we just have to change it once on the object rather than everywhere we're referencing it. The other step to make it even more loosely coupled is to use the permalink decorator to refer to a named url pattern in our URLconfs.
Interest and ToDoItem objects currently have this set so they'd be a great place to look for examples. Just remember that if you use a named url pattern you also need to define that with "name=" in the URLconf.
For documentation the following pages in the Django docs should be helpful:
Naming URL Patterns get_absolute_url Details on the permalink decorator are right after get_absolute_url