From c49ea6f5911296dcb40190c905e38b43cdc7c7a3 Mon Sep 17 00:00:00 2001 From: Curtis Maloney Date: Tue, 11 Sep 2018 03:00:34 +1000 Subject: Refs #20910 -- Replaced snippet directive with code-block. --- docs/intro/tutorial04.txt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'docs/intro/tutorial04.txt') diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt index 65caef3043..2eacd297ed 100644 --- a/docs/intro/tutorial04.txt +++ b/docs/intro/tutorial04.txt @@ -12,8 +12,8 @@ Write a simple form Let's update our poll detail template ("polls/detail.html") from the last tutorial, so that the template contains an HTML ``
`` element: -.. snippet:: html+django - :filename: polls/templates/polls/detail.html +.. code-block:: html+django + :caption: polls/templates/polls/detail.html

{{ question.question_text }}

@@ -58,16 +58,16 @@ Now, let's create a Django view that handles the submitted data and does something with it. Remember, in :doc:`Tutorial 3 `, we created a URLconf for the polls application that includes this line: -.. snippet:: - :filename: polls/urls.py +.. code-block:: python + :caption: polls/urls.py path('/vote/', views.vote, name='vote'), We also created a dummy implementation of the ``vote()`` function. Let's create a real version. Add the following to ``polls/views.py``: -.. snippet:: - :filename: polls/views.py +.. code-block:: python + :caption: polls/views.py from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render @@ -146,8 +146,8 @@ response documentation `. After somebody votes in a question, the ``vote()`` view redirects to the results page for the question. Let's write that view: -.. snippet:: - :filename: polls/views.py +.. code-block:: python + :caption: polls/views.py from django.shortcuts import get_object_or_404, render @@ -162,8 +162,8 @@ redundancy later. Now, create a ``polls/results.html`` template: -.. snippet:: html+django - :filename: polls/templates/polls/results.html +.. code-block:: html+django + :caption: polls/templates/polls/results.html

{{ question.question_text }}

@@ -234,8 +234,8 @@ Amend URLconf First, open the ``polls/urls.py`` URLconf and change it like so: -.. snippet:: - :filename: polls/urls.py +.. code-block:: python + :caption: polls/urls.py from django.urls import path @@ -259,8 +259,8 @@ Next, we're going to remove our old ``index``, ``detail``, and ``results`` views and use Django's generic views instead. To do so, open the ``polls/views.py`` file and change it like so: -.. snippet:: - :filename: polls/views.py +.. code-block:: python + :caption: polls/views.py from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render -- cgit v1.3