@@ -70,7 +70,7 @@ Now let's add a few more views to ``polls/views.py``. These views are
70
70
slightly different, because they take an argument:
71
71
72
72
.. code-block:: python
73
- :caption: polls/views.py
73
+ :caption: `` polls/views.py``
74
74
75
75
def detail(request, question_id):
76
76
return HttpResponse("You're looking at question %s." % question_id)
@@ -86,7 +86,7 @@ Wire these new views into the ``polls.urls`` module by adding the following
86
86
:func:`~django.urls.path` calls:
87
87
88
88
.. code-block:: python
89
- :caption: polls/urls.py
89
+ :caption: `` polls/urls.py``
90
90
91
91
from django.urls import path
92
92
@@ -147,7 +147,7 @@ view, which displays the latest 5 poll questions in the system, separated by
147
147
commas, according to publication date:
148
148
149
149
.. code-block:: python
150
- :caption: polls/views.py
150
+ :caption: `` polls/views.py``
151
151
152
152
from django.http import HttpResponse
153
153
@@ -196,7 +196,7 @@ Django as ``polls/index.html``.
196
196
Put the following code in that template:
197
197
198
198
.. code-block:: html+django
199
- :caption: polls/templates/polls/index.html
199
+ :caption: `` polls/templates/polls/index.html``
200
200
201
201
{% if latest_question_list %}
202
202
<ul>
@@ -218,7 +218,7 @@ __ https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Gett
218
218
Now let's update our ``index`` view in ``polls/views.py`` to use the template:
219
219
220
220
.. code-block:: python
221
- :caption: polls/views.py
221
+ :caption: `` polls/views.py``
222
222
223
223
from django.http import HttpResponse
224
224
from django.template import loader
@@ -251,7 +251,7 @@ template. Django provides a shortcut. Here's the full ``index()`` view,
251
251
rewritten:
252
252
253
253
.. code-block:: python
254
- :caption: polls/views.py
254
+ :caption: `` polls/views.py``
255
255
256
256
from django.shortcuts import render
257
257
@@ -280,7 +280,7 @@ Now, let's tackle the question detail view -- the page that displays the questio
280
280
for a given poll. Here's the view:
281
281
282
282
.. code-block:: python
283
- :caption: polls/views.py
283
+ :caption: `` polls/views.py``
284
284
285
285
from django.http import Http404
286
286
from django.shortcuts import render
@@ -302,7 +302,7 @@ later, but if you'd like to quickly get the above example working, a file
302
302
containing just:
303
303
304
304
.. code-block:: html+django
305
- :caption: polls/templates/polls/detail.html
305
+ :caption: `` polls/templates/polls/detail.html``
306
306
307
307
{{ question }}
308
308
@@ -316,7 +316,7 @@ and raise :exc:`~django.http.Http404` if the object doesn't exist. Django
316
316
provides a shortcut. Here's the ``detail()`` view, rewritten:
317
317
318
318
.. code-block:: python
319
- :caption: polls/views.py
319
+ :caption: `` polls/views.py``
320
320
321
321
from django.shortcuts import get_object_or_404, render
322
322
@@ -358,7 +358,7 @@ variable ``question``, here's what the ``polls/detail.html`` template might look
358
358
like:
359
359
360
360
.. code-block:: html+django
361
- :caption: polls/templates/polls/detail.html
361
+ :caption: `` polls/templates/polls/detail.html``
362
362
363
363
<h1>{{ question.question_text }}</h1>
364
364
<ul>
@@ -432,7 +432,7 @@ The answer is to add namespaces to your URLconf. In the ``polls/urls.py``
432
432
file, go ahead and add an ``app_name`` to set the application namespace:
433
433
434
434
.. code-block:: python
435
- :caption: polls/urls.py
435
+ :caption: `` polls/urls.py``
436
436
437
437
from django.urls import path
438
438
@@ -449,14 +449,14 @@ file, go ahead and add an ``app_name`` to set the application namespace:
449
449
Now change your ``polls/index.html`` template from:
450
450
451
451
.. code-block:: html+django
452
- :caption: polls/templates/polls/index.html
452
+ :caption: `` polls/templates/polls/index.html``
453
453
454
454
<li><a href="{% url 'detail' question.id %}">{{ question.question_text }}</a></li>
455
455
456
456
to point at the namespaced detail view:
457
457
458
458
.. code-block:: html+django
459
- :caption: polls/templates/polls/index.html
459
+ :caption: `` polls/templates/polls/index.html``
460
460
461
461
<li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li>
462
462
0 commit comments