why at first do you have to put in post.slug every time?
I don't quite get it. Where do you put slug in? database? html?
Answers
When we first start using {% url 'blog:detail' %} we have to include the post.slug value in the tag or Django won't be able to reverse the URL name we've given it, since the name expects a slug to come along with it. This is only required in the HTML, the database entries automatically create and save their slug.
As for why get_absolute_url helps up stop repeating ourselves, now, every time we want to link to a specific blog post, we just have to have the post as an object (say post), and then print out post.get_absolute_url, which is much less typing than {% url 'blog:detail' post.slug %} every time. And less than reverse('blog:detail', {'slug': post.slug}) in views/forms/etc.
follow up question: how does get_absolute_url help stop repeating it?