| | 703 | * Default widget: ``TextInput`` |
| | 704 | * Empty value: ``''`` (an empty string) |
| | 705 | * Normalizes to: A Unicode object. |
| | 706 | * Validates that the given value against each of the fields specified |
| | 707 | as an argument to the ``ComboField``. |
| | 708 | * Error message keys: ``required``, ``invalid`` |
| | 709 | |
| | 710 | Takes one extra required argument: |
| | 711 | |
| | 712 | .. attribute:: ComboField.fields |
| | 713 | |
| | 714 | The list of fields that should be used to validate the field's value (in the |
| | 715 | order in which they are provided). |
| | 716 | |
| | 717 | >>> f = ComboField(fields=[CharField(max_length=20), EmailField()]) |
| | 718 | >>> f.clean('test@example.com') |
| | 719 | u'test@example.com' |
| | 720 | >>> f.clean('longemailaddress@example.com') |
| | 721 | Traceback (most recent call last): |
| | 722 | ... |
| | 723 | ValidationError: [u'Ensure this value has at most 20 characters (it has 28).'] |
| | 724 | |
| | 727 | * Default widget: ``TextInput`` |
| | 728 | * Empty value: ``''`` (an empty string) |
| | 729 | * Normalizes to: the type returned by the ``compress`` method of the subclass. |
| | 730 | * Validates that the given value against each of the fields specified |
| | 731 | as an argument to the ``MultiValueField``. |
| | 732 | * Error message keys: ``required``, ``invalid`` |
| | 733 | |
| | 734 | This abstract field (must be subclassed) aggregates the logic of multiple |
| | 735 | fields. Subclasses should not have to implement clean(). Instead, they must |
| | 736 | implement compress(), which takes a list of valid values and returns a |
| | 737 | "compressed" version of those values -- a single value. For example, |
| | 738 | :class:`SplitDateTimeField` is a subclass which combines a time field and |
| | 739 | a date field into a datetime object. |
| | 740 | |
| | 741 | Takes one extra required argument: |
| | 742 | |
| | 743 | .. attribute:: MultiValueField.fields |
| | 744 | |
| | 745 | A list of fields which are cleaned into a single field. Each value in ``clean`` |
| | 746 | is cleaned by the corresponding field in ``fields`` -- the first value is |
| | 747 | cleaned by the first field, the second value is cleaned by thesecond field, etc. |
| | 748 | Once all fields are cleaned, the list of clean values is"compressed" into a |
| | 749 | single value. |
| | 750 | |