URLタグ
‘post_detail’の部分はアプリケーション名/urls.pyに記述されたパス、name=’post_detail’の部分を呼び出しています。
{% for post in posts %}
<div>
<h2><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h2>
{% endfor %}
‘post_detail’の部分はアプリケーション名/urls.pyに記述されたパス、name=’post_detail’の部分を呼び出しています。
{% for post in posts %}
<div>
<h2><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h2>
{% endfor %}