diff --git a/first_django_app.md b/first_django_app.md index 08a5f1e..c7cc962 100644 --- a/first_django_app.md +++ b/first_django_app.md @@ -223,4 +223,20 @@ Here `path()` function is passed **route** and **view**; two additional option a ``` -模板系统统一使用点符号来访问变量的属性 \ No newline at end of file +模板系统统一使用点符号来访问变量的属性 + +### 3.5 Remove hardlink URL in template + +In template `polls/index.html`, links are hardcoded as shown + +```html + {% for question in latest_question_list %} +
  • {{ question.question_text }}
  • + {% endfor %} +``` + +Consider `index.html` will be reused numerous times, 去耦合is necessary. + +```html +
  • {{ question.question_text }}
  • +``` \ No newline at end of file diff --git a/src/polls/templates/polls/index.html b/src/polls/templates/polls/index.html index 79823ba..0d002dd 100644 --- a/src/polls/templates/polls/index.html +++ b/src/polls/templates/polls/index.html @@ -1,7 +1,7 @@ {% if latest_question_list %} {% else %}