Ticket #5327: 5327.diff

File 5327.diff, 1.6 KB (added by Philippe Raoult, 17 years ago)

clarification of the docs concerning ModelChoices

  • docs/newforms.txt

     
    11061106    * Validates that the given value exists in the list of choices.
    11071107
    11081108Takes one extra argument, ``choices``, which is an iterable (e.g., a list or
    1109 tuple) of 2-tuples to use as choices for this field.
     1109tuple) of 2-tuples to use as choices for this field. The first item of each tuple
     1110will be used for the value and the second for the display. The normalized value
     1111will be the first item of the tuple corresponding to the entry selected by the user.
    11101112
     1113``ModelChoiceField``
     1114~~~~~~~~~~~~~~~
     1115
     1116    * Default widget: ``Select``
     1117    * Empty value: ``None``
     1118    * Normalizes to: An instance.
     1119    * Validates that the given id exists in the queryset.
     1120
     1121Takes one extra argument, ``queryset``, which is QuerySet containing the
     1122instances to choose. The instances' ``__unicode__`` method will be used for display.
     1123
    11111124``DateField``
    11121125~~~~~~~~~~~~~
    11131126
     
    12551268Takes one extra argument, ``choices``, which is an iterable (e.g., a list or
    12561269tuple) of 2-tuples to use as choices for this field.
    12571270
     1271``ModelMultipleChoiceField``
     1272~~~~~~~~~~~~~~~
     1273
     1274    * Default widget: ``SelectMultiple``
     1275    * Empty value: ``[]`` (an empty list)
     1276    * Normalizes to: A list of instances.
     1277    * Validates that every id in the given list of values exists in the queryset.
     1278
     1279Takes one extra argument, ``queryset``, which is QuerySet containing the
     1280instances to choose. The instances' ``__unicode__`` method will be used for display.
     1281
     1282
    12581283``NullBooleanField``
    12591284~~~~~~~~~~~~~~~~~~~~
    12601285
Back to Top