Changes between Version 10 and Version 11 of NewForms
- Timestamp:
- Jul 27, 2007, 2:08:26 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewForms
v10 v11 2 2 Since newforms is mostly undocumented at the moment this page summarizes some useful information. This documentation should be considered complementary to the documentation on [http://www.djangoproject.com/documentation/newforms/]. It's mostly information extracted from the [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py unit tests for newforms] at the moment. 3 3 4 == Widgets [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 8Unit tests] ==4 == Widgets [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L15 Unit tests] == 5 5 Each `Widget` subclass corresponds to an HTML form widget. A `Widget` knows how to 6 6 render itself, given a field name and some data. Widgets don't perform … … 11 11 12 12 13 ===== !TextInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L15 Unit test] ===== 14 ===== !PasswordInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L46 Unit test] ===== 15 ===== !HiddenInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L75 Unit test] ===== 16 ===== !FileInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L109 Unit test] ===== 17 ===== Textarea [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L133 Unit test] ===== 18 ===== !CheckboxInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L162 Unit test] ===== 19 ===== Select [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L215 Unit test] ===== 20 ===== !SelectMultiple [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L299 Unit test] ===== 21 ===== !RadioSelect [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L406 Unit test] ===== 22 ===== !CheckboxSelectMultiple [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L536 Unit test] ===== 13 ===== !TextInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L23 Unit test] ===== 14 ===== !PasswordInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L54 Unit test] ===== 15 ===== !HiddenInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L99 Unit test] ===== 16 ===== !MultipleHiddenInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L132 Unit test] ===== 17 ===== !FileInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L173 Unit test] ===== 18 ===== Textarea [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L197 Unit test] ===== 19 ===== !CheckboxInput [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L226 Unit test] ===== 20 ===== Select [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L279 Unit test] ===== 21 ===== !NullBooleanSelect [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L395 Unit test] ===== 22 ===== !SelectMultiple [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L429 Unit test] ===== 23 ===== !RadioSelect [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L536 Unit test] ===== 24 ===== !CheckboxSelectMultiple [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L691 Unit test] ===== 25 ===== Multi [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L798 Unit test] ===== 26 ===== !SplitDateTime [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L818 Unit test] ===== 23 27 24 28 … … 35 39 Other than that, the Field subclasses have class-specific options for `__init__()`. For example, !CharField has a `max_length` option. 36 40 37 === Field types [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 644Unit tests] ===41 === Field types [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L836 Unit tests] === 38 42 List of field types with their associated unit test for easy lookup. 39 43 40 ===== !CharField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 669Unit test] =====44 ===== !CharField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L860 Unit test] ===== 41 45 Arguments: 42 46 * ''max_length'' -- (optional) Maximum number of characters 43 47 * ''min_length'' -- (optional) Minimum number of characters 44 48 45 ===== !IntegerField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 735Unit test] =====49 ===== !IntegerField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L928 Unit test] ===== 46 50 Arguments: 47 51 * ''max_value'' -- (optional) Maximum value 48 52 * ''min_value'' -- (optional) Minimum value 49 53 50 ===== !DateField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L858 Unit test] ===== 54 ===== !FloatField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1053 Unit test] ===== 55 56 ===== !DecimalField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1111 Unit test] ===== 57 58 ===== !DateField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1184 Unit test] ===== 51 59 Arguments: 52 60 * ''input_formats'' -- (optional) A list of `strftime()` input formats. These will override all other input formats 53 61 54 ===== !TimeField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 935Unit test] =====62 ===== !TimeField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1261 Unit test] ===== 55 63 56 ===== !DateTimeField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L 974Unit test] =====64 ===== !DateTimeField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1300 Unit test] ===== 57 65 58 ===== !RegexField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 047Unit test] =====66 ===== !RegexField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1373 Unit test] ===== 59 67 Arguments: 60 68 * ''regex'' -- The regular expression in compiled or string form that the input should match 61 69 62 ===== !EmailField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 138Unit test] =====70 ===== !EmailField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1464 Unit test] ===== 63 71 Arguments: 64 72 * ''min_length'' -- Minimum length 65 73 * ''max_length'' -- Maximum length 66 74 67 ===== URLField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 243 Unit test] =====75 ===== URLField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1523 Unit test] ===== 68 76 Arguments: 69 77 * ''min_length'' -- Minimum length … … 71 79 * ''verify_exists'' -- Defaults to ''False''. If ''True'', verifies that the URL is live on the Internet and doesn't return a 404 or 500 72 80 73 ===== !BooleanField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 302Unit test] =====81 ===== !BooleanField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1633 Unit test] ===== 74 82 Since HTML forms either return something like '`fieldname=on`' in `request.POST` or `request.GET`, this value may not be set in `form.clean_data()`. 75 83 … … 77 85 * ''None'' 78 86 79 ===== !ChoiceField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 340Unit test] =====87 ===== !ChoiceField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1671 Unit test] ===== 80 88 Arguments: 81 89 * ''choices'' -- A list of (key, value) pairs 82 90 83 ===== !MultipleChoiceField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 382Unit test] =====91 ===== !MultipleChoiceField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1727 Unit test] ===== 84 92 Arguments: 85 93 * ''choices'' -- A list of (key, value) pairs 86 94 87 ===== !ComboField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1 448Unit test] =====95 ===== !ComboField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1793 Unit test] ===== 88 96 !ComboField takes a list of fields that should be used to validate a value, in that order. 89 97 … … 91 99 * ''choices'' -- A list of fields used to validate the input value 92 100 93 == Forms [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1489 Unit test] == 101 ===== !SplitDateTimeField [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1833 Unit test] ===== 102 103 == Forms [http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L1901 Unit test] == 94 104 A Form is a collection of Fields. It knows how to validate a set of data and it knows how to render itself in a couple of default ways (e.g., an HTML table). 95 105