diff options
| author | James Bennett <ubernostrum@gmail.com> | 2008-03-18 18:20:45 +0000 |
|---|---|---|
| committer | James Bennett <ubernostrum@gmail.com> | 2008-03-18 18:20:45 +0000 |
| commit | 75617ef69f7b0fa491ce1d3cb5d4a8d478203ad1 (patch) | |
| tree | a7294edc36a1c8de13b4e6775898dc9c36d0783e /docs | |
| parent | a752a3d41973dfae6c03d927f030e5975e836e6b (diff) | |
Fixed #6120: First stab at documenting newforms field types which handle relationships.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7298 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/newforms.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt index 0b5559ab88..4e5df6d149 100644 --- a/docs/newforms.txt +++ b/docs/newforms.txt @@ -1499,6 +1499,33 @@ the bottom of this document, for examples of their use. ``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 ---------------------- |
