Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
QUYEN NGUYEN5,100 Points
reverse and get_absolute_url ?
Can somebody help me understand the reverse and the get_absolute_url please. I really confuse and don't understand. I try to read the document but i still dont get it.
Chris FreemanTreehouse Moderator 68,388 Points
get_absolute_url() is intended to be defined on a Model so that model.
get_absolute_url() will return a URL string that would point to this model's view. This method can be called from a template.
See get_absolute_url in the docs.
reverse() function from django.utils.reverse uses the
name attributes in URLs defined by
url(_) [before django 2.0] or
path() [django 2.0+].
In templates, the url filter can be used in place of
reverse() to obtain the URL path based on the
Post back if you need more details. Good luck!