diff options
| author | areski <areski@gmail.com> | 2014-08-18 16:30:44 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-08-19 16:44:25 -0400 |
| commit | 9d6551204eff9d1ab70b67578f99630716df7490 (patch) | |
| tree | f8a8722912985f6b0876d58909880df172a77703 /docs/topics/forms | |
| parent | fa02120d360387bebbbe735e86686bb4c7c43db2 (diff) | |
Removed unnecessary code-block directives.
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 8 | ||||
| -rw-r--r-- | docs/topics/forms/index.txt | 16 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 8 |
3 files changed, 12 insertions, 20 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 7595bbe4ae..f386e845cb 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -554,9 +554,7 @@ Using a formset in views and templates Using a formset inside a view is as easy as using a regular ``Form`` class. The only thing you will want to be aware of is making sure to use the -management form inside the template. Let's look at a sample view: - -.. code-block:: python +management form inside the template. Let's look at a sample view:: from django.forms.formsets import formset_factory from django.shortcuts import render_to_response @@ -633,9 +631,7 @@ You are able to use more than one formset in a view if you like. Formsets borrow much of its behavior from forms. With that said you are able to use ``prefix`` to prefix formset form field names with a given value to allow more than one formset to be sent to a view without name clashing. Lets take -a look at how this might be accomplished: - -.. code-block:: python +a look at how this might be accomplished:: from django.forms.formsets import formset_factory from django.shortcuts import render_to_response diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index 439574873a..4df70ede46 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -224,9 +224,7 @@ 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: - -.. code-block:: python +it in Django is this:: from django import forms @@ -273,9 +271,7 @@ same view which published the form. This allows us to reuse some of the same logic. To handle the form we need to instantiate it in the view for the URL where we -want it to be published: - -.. code-block:: python +want it to be published:: from django.shortcuts import render from django.http import HttpResponseRedirect @@ -386,9 +382,7 @@ 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 Web site: - -.. code-block:: python +to implement "contact me" functionality on a personal Web site:: from django import forms @@ -434,9 +428,7 @@ In the contact form example above, ``cc_myself`` will be a boolean value. Likewise, fields such as :class:`IntegerField` and :class:`FloatField` convert values to a Python ``int`` and ``float`` respectively. -Here's how the form data could be processed in the view that handles this form: - -.. code-block:: python +Here's how the form data could be processed in the view that handles this form:: from django.core.mail import send_mail diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 4ac4dcea90..f457361b6c 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -851,7 +851,9 @@ Saving objects in the formset ----------------------------- As with a ``ModelForm``, you can save the data as a model object. This is done -with the formset's ``save()`` method:: +with the formset's ``save()`` method: + +.. code-block:: python # Create a formset instance with POST data. >>> formset = AuthorFormSet(request.POST) @@ -869,7 +871,9 @@ excluded), these fields will not be set by the ``save()`` method. You can find more information about this restriction, which also holds for regular ``ModelForms``, in `Selecting the fields to use`_. -Pass ``commit=False`` to return the unsaved model instances:: +Pass ``commit=False`` to return the unsaved model instances: + +.. code-block:: python # don't save to the database >>> instances = formset.save(commit=False) |
