Django

Code

Changeset 7386

Show
Ignore:
Timestamp:
03/29/08 23:21:50 (8 months ago)
Author:
ubernostrum
Message:

Clean up some awkwardness and confusion in the docs for ModelChoiceField?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/newforms.txt

    r7326 r7386  
    15501550~~~~~~~~~~~~~~~~~~~~ 
    15511551 
    1552 Allows the selection of a single model object, suitable for representing a 
    1553 foreign key. The method receives an object as an argument and must return a 
    1554 string to represent it. 
    1555  
    1556 The labels for the choice field call the ``__unicode__`` method of the model to 
    1557 generate string representations. To provide custom labels, subclass ``ModelChoiceField`` and override ``label_for_model``:: 
     1552Allows the selection of a single model object, suitable for 
     1553representing a foreign key. 
     1554 
     1555The labels for the choice field call the ``__unicode__`` method of the 
     1556model to generate string representations to use in the field's 
     1557choices; to provide customized representations,, subclass 
     1558``ModelChoiceField`` and override ``label_for_model``; this method 
     1559will receive an object, and should return a string suitable for 
     1560representing it:: 
    15581561 
    15591562    class MyModelChoiceField(ModelChoiceField): 
     
    15641567~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    15651568 
    1566 Allows the selection of one or more model objects, suitable for representing a 
    1567 many-to-many relation. As with ``ModelChoiceField``, you can use 
    1568 ``label_from_instance`` to customize the object labels. 
     1569Allows the selection of one or more model objects, suitable for 
     1570representing a many-to-many relation. As with ``ModelChoiceField``, 
     1571you can use ``label_from_instance`` to customize the object 
     1572representations. 
    15691573 
    15701574Creating custom fields