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 47,861 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!