diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2012-08-10 12:40:37 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2012-08-10 12:40:37 +0100 |
| commit | 184cf9ab798d5b25d855649ddb2ca580949778df (patch) | |
| tree | 8512633ec04a6979b0953e32e73c9a43d09e5805 /docs/intro/tutorial03.txt | |
| parent | c4b2a3262cc79383d6562cfc7e9af20135c8e0bf (diff) | |
| parent | 7275576235ae2e87f3de7b0facb3f9b0a2368f28 (diff) | |
Merge branch 'master' into schema-alteration
Diffstat (limited to 'docs/intro/tutorial03.txt')
| -rw-r--r-- | docs/intro/tutorial03.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index fd3a04ba93..d15b2f43ae 100644 --- a/docs/intro/tutorial03.txt +++ b/docs/intro/tutorial03.txt @@ -533,5 +533,22 @@ under "/content/polls/", or any other path root, and the app will still work. All the poll app cares about is its relative path, not its absolute path. +Removing hardcoded URLs in templates +------------------------------------ + +Remember, when we wrote the link to a poll in our template, the link was +partially hardcoded like this: + +.. code-block:: html+django + + <li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li> + +To use the decoupled URLs we've just introduced, replace the hardcoded link +with the :ttag:`url` template tag: + +.. code-block:: html+django + + <li><a href="{% url 'polls.views.detail' poll.id %}">{{ poll.question }}</a></li> + When you're comfortable with writing views, read :doc:`part 4 of this tutorial </intro/tutorial04>` to learn about simple form processing and generic views. |
