diff options
Diffstat (limited to 'docs/topics/forms')
-rw-r--r-- | docs/topics/forms/formsets.txt | 1 | ||||
-rw-r--r-- | docs/topics/forms/index.txt | 14 | ||||
-rw-r--r-- | docs/topics/forms/media.txt | 2 | ||||
-rw-r--r-- | docs/topics/forms/modelforms.txt | 10 |
4 files changed, 10 insertions, 17 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 732fd93de1..e7b09dc409 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -1,4 +1,3 @@ -.. _topics-forms-formsets: .. _formsets: Formsets diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index 119e943889..cef322a02f 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -1,5 +1,3 @@ -.. _topics-forms-index: - ================== Working with forms ================== @@ -7,8 +5,8 @@ Working with forms .. admonition:: About this document This document provides an introduction to Django's form handling features. - 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`. + For a more detailed look at the forms API, see :doc:`/ref/forms/api`. For + documentation of the available field types, see :doc:`/ref/forms/fields`. .. highlightlang:: html+django @@ -77,10 +75,10 @@ personal Web site: A form is composed of ``Field`` objects. In this case, our form has four fields: ``subject``, ``message``, ``sender`` and ``cc_myself``. ``CharField``, ``EmailField`` and ``BooleanField`` are just three of the available field types; -a full list can be found in :ref:`ref-forms-fields`. +a full list can be found in :doc:`/ref/forms/fields`. If your form is going to be used to directly add or edit a Django model, you can -use a :ref:`ModelForm <topics-forms-modelforms>` to avoid duplicating your model +use a :doc:`ModelForm </topics/forms/modelforms>` to avoid duplicating your model description. Using a form in a view @@ -163,7 +161,7 @@ Extending the above example, here's how the form data could be processed: send_mail(subject, message, sender, recipients) return HttpResponseRedirect('/thanks/') # Redirect after POST -For more on sending e-mail from Django, see :ref:`topics-email`. +For more on sending e-mail from Django, see :doc:`/topics/email`. Displaying a form using a template ---------------------------------- @@ -397,4 +395,4 @@ This covers the basics, but forms can do a whole lot more: .. seealso:: - The :ref:`form API reference <ref-forms-index>`. + The :doc:`form API reference </ref/forms/index>`. diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt index 663b0d3113..64cf50743d 100644 --- a/docs/topics/forms/media.txt +++ b/docs/topics/forms/media.txt @@ -1,5 +1,3 @@ -.. _topics-forms-media: - Form Media ========== diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index fd3edf5104..2cdd2bfa74 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -1,5 +1,3 @@ -.. _topics-forms-modelforms: - ========================== Creating forms from models ========================== @@ -446,7 +444,7 @@ parameter when declaring the form field:: class Meta: model = Article - See the :ref:`form field documentation <ref-forms-fields>` for more information + See the :doc:`form field documentation </ref/forms/fields>` for more information on fields and their arguments. Changing the order of fields @@ -540,7 +538,7 @@ Interaction with model validation As part of its validation process, ``ModelForm`` will call the ``clean()`` method of each field on your model that has a corresponding field on your form. If you have excluded any model fields, validation will not be run on those -fields. See the :ref:`form validation <ref-forms-validation>` documentation +fields. See the :doc:`form validation </ref/forms/validation>` documentation for more on how field cleaning and validation work. Also, your model's ``clean()`` method will be called before any uniqueness checks are made. See :ref:`Validating objects <validating-objects>` for more information on the @@ -551,7 +549,7 @@ model's ``clean()`` hook. Model formsets ============== -Like :ref:`regular formsets <topics-forms-formsets>`, Django provides a couple +Like :doc:`regular formsets </topics/forms/formsets>`, Django provides a couple of enhanced formset classes that make it easy to work with Django models. Let's reuse the ``Author`` model from above:: @@ -595,8 +593,8 @@ Alternatively, you can create a subclass that sets ``self.queryset`` in class BaseAuthorFormSet(BaseModelFormSet): def __init__(self, *args, **kwargs): - self.queryset = Author.objects.filter(name__startswith='O') super(BaseAuthorFormSet, self).__init__(*args, **kwargs) + self.queryset = Author.objects.filter(name__startswith='O') Then, pass your ``BaseAuthorFormSet`` class to the factory function:: |