get_absolute_url and url template tag
I would like to understand what is the benefit to use the get_absolute_url
call instead of the url template tag.
get_absolute_url:
class Project(models.Model):
@permalink
def get_absolute_url(self):
return ('view_project', (), {'project_id': self.pk})
<a href="{{ project.get_absolute_url }}"> {{ project.name }}</a>
url template tag:
<a href="{% url 'view_project' project.pk %}"> {{ project.name }}</a>
Thank you for your help,
Julio
No comments:
Post a Comment