1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #20910 -- Replaced snippet directive with code-block.

This commit is contained in:
Curtis Maloney
2018-09-11 03:00:34 +10:00
committed by Tim Graham
parent f8ff529ee3
commit c49ea6f591
32 changed files with 234 additions and 375 deletions

View File

@@ -226,8 +226,8 @@ The :class:`Form` class
We already know what we want our HTML form to look like. Our starting point for
it in Django is this:
.. snippet::
:filename: forms.py
.. code-block:: python
:caption: forms.py
from django import forms
@@ -276,8 +276,8 @@ logic.
To handle the form we need to instantiate it in the view for the URL where we
want it to be published:
.. snippet::
:filename: views.py
.. code-block:: python
:caption: views.py
from django.http import HttpResponseRedirect
from django.shortcuts import render
@@ -404,8 +404,8 @@ More on fields
Consider a more useful form than our minimal example above, which we could use
to implement "contact me" functionality on a personal website:
.. snippet::
:filename: forms.py
.. code-block:: python
:caption: forms.py
from django import forms
@@ -453,8 +453,8 @@ values to a Python ``int`` and ``float`` respectively.
Here's how the form data could be processed in the view that handles this form:
.. snippet::
:filename: views.py
.. code-block:: python
:caption: views.py
from django.core.mail import send_mail