summaryrefslogtreecommitdiff
path: root/docs/newforms.txt
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-01 00:28:15 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-01 00:28:15 +0000
commit4efe9675c5fd5a030737d957b3588184f06117fe (patch)
treeb3ea195f6a3a281428c9cd5789e386493edc5379 /docs/newforms.txt
parent70913a2c4358de7341525ab0e913fafd213022c2 (diff)
queryset-refactor: Merged from trunk up to [7388].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7396 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/newforms.txt')
-rw-r--r--docs/newforms.txt19
1 files changed, 11 insertions, 8 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt
index 533ff75185..d07f7f9dc3 100644
--- a/docs/newforms.txt
+++ b/docs/newforms.txt
@@ -1549,12 +1549,14 @@ additional required argument:
``ModelChoiceField``
~~~~~~~~~~~~~~~~~~~~
-Allows the selection of a single model object, suitable for representing a
-foreign key. The method receives an object as an argument and must return a
-string to represent it.
+Allows the selection of a single model object, suitable for
+representing a foreign key.
-The labels for the choice field call the ``__unicode__`` method of the model to
-generate string representations. To provide custom labels, subclass ``ModelChoiceField`` and override ``label_for_model``::
+The ``__unicode__`` method of the model will be called to generate
+string representations of the objects for use in the field's choices;
+to provide customized representations, subclass ``ModelChoiceField``
+and override ``label_for_model``. This method will receive model
+object, and should return a string suitable for representing it::
class MyModelChoiceField(ModelChoiceField):
def label_from_instance(self, obj):
@@ -1563,9 +1565,10 @@ generate string representations. To provide custom labels, subclass ``ModelChoic
``ModelMultipleChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Allows the selection of one or more model objects, suitable for representing a
-many-to-many relation. As with ``ModelChoiceField``, you can use
-``label_from_instance`` to customize the object labels.
+Allows the selection of one or more model objects, suitable for
+representing a many-to-many relation. As with ``ModelChoiceField``,
+you can use ``label_from_instance`` to customize the object
+representations.
Creating custom fields
----------------------