diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-09-09 01:54:20 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-09-09 01:54:20 +0000 |
| commit | 74f386dba274e319eb9e76cfb6f5d38e602104d9 (patch) | |
| tree | f39a1983daa4cf5650927daa729cf7f39176ae2b /docs/topics/forms | |
| parent | 834a041e67b61f84b095c0796ed085f4c4785b0a (diff) | |
Fixed #8979 -- Made a bunch of typo/formatting fixes to the docs. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 8 | ||||
| -rw-r--r-- | docs/topics/forms/index.txt | 14 |
2 files changed, 17 insertions, 5 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index ca7aa2e14f..f3aa4a947e 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -306,7 +306,9 @@ management form inside the template. Lets look at a sample view:: formset = ArticleFormSet() return render_to_response('manage_articles.html', {'formset': formset}) -The ``manage_articles.html`` template might look like this:: +The ``manage_articles.html`` template might look like this: + +.. code-block:: html+django <form method="POST" action=""> {{ formset.management_form }} @@ -318,7 +320,9 @@ The ``manage_articles.html`` template might look like this:: </form> However the above can be slightly shortcutted and let the formset itself deal -with the management form:: +with the management form: + +.. code-block:: html+django <form method="POST" action=""> <table> diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index 48b4b2b28c..5cc76bdee8 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -10,6 +10,8 @@ Working with forms For a more detailed look at the forms API, see :ref:`ref-forms-api`. For documentation of the available field types, see :ref:`ref-forms-fields`. +.. highlightlang:: html+django + ``django.forms`` is Django's form-handling library. While it is possible to process form submissions just using Django's @@ -60,7 +62,9 @@ make use of a declarative style that you'll be familiar with if you've used Django's database models. For example, consider a form used to implement "contact me" functionality on a -personal Web site:: +personal Web site: + +.. code-block:: python from django import forms @@ -82,7 +86,9 @@ description. Using a form in a view ---------------------- -The standard pattern for processing a form in a view looks like this:: +The standard pattern for processing a form in a view looks like this: + +.. code-block:: python def contact(request): if request.method == 'POST': # If the form has been submitted... @@ -133,7 +139,9 @@ also be converted in to the relevant Python types for you. In the above example, ``cc_myself`` will be a boolean value. Likewise, fields such as ``IntegerField`` and ``FloatField`` convert values to a Python int and float respectively. -Extending the above example, here's how the form data could be processed:: +Extending the above example, here's how the form data could be processed: + +.. code-block:: python if form.is_valid(): subject = form.cleaned_data['subject'] |
