Skip to content

Commit

Permalink
Fixed #6120: First stab at documenting newforms field types which han…
Browse files Browse the repository at this point in the history
…dle relationships.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7298 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
ubernostrum committed Mar 18, 2008
1 parent a752a3d commit 75617ef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/newforms.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1499,6 +1499,33 @@ the bottom of this document, for examples of their use.
``SplitDateTimeField`` ``SplitDateTimeField``
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~


Fields which handle relationships
---------------------------------

For representing relationships between models, two fields are
provided which can derive their choices from a ``QuerySet``, and which
place one or more model objects into the ``cleaned_data`` dictionary
of forms in which they're used. Both of these fields have an
additional required argument:

``queryset``
A ``QuerySet`` of model objects from which the choices for the
field will be derived, and which will be used to validate the
user's selection.

``ModelChoiceField``
~~~~~~~~~~~~~~~~~~~~

Allows the selection of a single model object, suitable for
representing a foreign key.

``ModelMultipleChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Allows the selection of one or more model objects, suitable for
representing a many-to-many relation.


Creating custom fields Creating custom fields
---------------------- ----------------------


Expand Down

0 comments on commit 75617ef

Please sign in to comment.