summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial07.txt
diff options
context:
space:
mode:
authorCurtis Maloney <curtis@tinbrain.net>2018-09-11 03:00:34 +1000
committerTim Graham <timograham@gmail.com>2018-09-10 13:00:34 -0400
commitc49ea6f5911296dcb40190c905e38b43cdc7c7a3 (patch)
tree56d6341ed09e5d77cd3361bcc5275eab5733db4a /docs/intro/tutorial07.txt
parentf8ff529ee32c79b270176f5e8d7a3f6ef048ac31 (diff)
Refs #20910 -- Replaced snippet directive with code-block.
Diffstat (limited to 'docs/intro/tutorial07.txt')
-rw-r--r--docs/intro/tutorial07.txt36
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/intro/tutorial07.txt b/docs/intro/tutorial07.txt
index 5924f55c6a..001c6ec998 100644
--- a/docs/intro/tutorial07.txt
+++ b/docs/intro/tutorial07.txt
@@ -18,8 +18,8 @@ Django the options you want when you register the object.
Let's see how this works by reordering the fields on the edit form. Replace
the ``admin.site.register(Question)`` line with:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
from django.contrib import admin
@@ -47,8 +47,8 @@ of fields, choosing an intuitive order is an important usability detail.
And speaking of forms with dozens of fields, you might want to split the form
up into fieldsets:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
from django.contrib import admin
@@ -81,8 +81,8 @@ Yet.
There are two ways to solve this problem. The first is to register ``Choice``
with the admin just as we did with ``Question``. That's easy:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
from django.contrib import admin
@@ -115,8 +115,8 @@ It'd be better if you could add a bunch of Choices directly when you create the
Remove the ``register()`` call for the ``Choice`` model. Then, edit the ``Question``
registration code to read:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
from django.contrib import admin
@@ -162,8 +162,8 @@ fields for entering related ``Choice`` objects. For that reason, Django offers a
tabular way of displaying inline related objects; you just need to change
the ``ChoiceInline`` declaration to read:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
class ChoiceInline(admin.TabularInline):
#...
@@ -194,8 +194,8 @@ more helpful if we could display individual fields. To do that, use the
tuple of field names to display, as columns, on the change list page for the
object:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
class QuestionAdmin(admin.ModelAdmin):
# ...
@@ -204,8 +204,8 @@ object:
Just for good measure, let's also include the ``was_published_recently()``
method from :doc:`Tutorial 2 </intro/tutorial02>`:
-.. snippet::
- :filename: polls/admin.py
+.. code-block:: python
+ :caption: polls/admin.py
class QuestionAdmin(admin.ModelAdmin):
# ...
@@ -226,8 +226,8 @@ representation of the output.
You can improve that by giving that method (in :file:`polls/models.py`) a few
attributes, as follows:
-.. snippet::
- :filename: polls/models.py
+.. code-block:: python
+ :caption: polls/models.py
class Question(models.Model):
# ...
@@ -301,8 +301,8 @@ keeping your templates within the project is a good convention to follow.
Open your settings file (:file:`mysite/settings.py`, remember) and add a
:setting:`DIRS <TEMPLATES-DIRS>` option in the :setting:`TEMPLATES` setting:
-.. snippet::
- :filename: mysite/settings.py
+.. code-block:: python
+ :caption: mysite/settings.py
TEMPLATES = [
{