Commit Graph

76 Commits

Author SHA1 Message Date
Adrian Holovaty 71ce11f617 newforms: Implemented form_for_instance(). The resulting Form class does not yet have a method that saves the changes
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 01:16:29 +00:00
Adrian Holovaty 2cb0fe71a2 newforms: Added 'initial' parameter to Field. This allows you to specify initial data that will be displayed with the form if no data is given. Also added unit tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 00:01:52 +00:00
Adrian Holovaty b5cd7d469d newforms: Added max_length and min_length optional arguments to RegexField, EmailField and URLField. Note that the argument order for those three fields has changed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:46:10 +00:00
Adrian Holovaty d0fcef9db0 newforms: A label can now be the empty string, in which case a label won't be displayed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:33:20 +00:00
Adrian Holovaty 30c2bffe17 newforms: Changed Form.as_table() to display errors in same <td> as the field
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:16:16 +00:00
Adrian Holovaty 247fdc19ad newforms: Implemented RadioFieldRenderer.__getitem__(), which allows for index lookup on radio fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4238 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 22:56:53 +00:00
Adrian Holovaty 86870e7587 newforms: Added django.newforms.extras.widgets, with SelectDateWidget implementation, plus some unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-24 20:22:38 +00:00
Adrian Holovaty 3d9b12b2d8 newforms: Removed Widget.requires_data_list parameter, which was made redundant by Widget.value_from_datadict()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-24 03:36:49 +00:00
Adrian Holovaty cd394a246a Fixed #3153 -- newforms 'label' argument now can contain wacky characters. Thanks, dswistowski
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17 19:04:03 +00:00
Adrian Holovaty a0ef6f6915 newforms: Added optional 'form' parameter to form_for_model
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17 05:12:53 +00:00
Adrian Holovaty e76e2aaffb newforms: Added BaseForm to django.newforms namespace
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4219 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17 05:11:48 +00:00
Adrian Holovaty 546297be27 newforms: Implemented min_value and max_value options for IntegerField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 23:18:47 +00:00
Adrian Holovaty 26489d4e2a newforms: Fixed unexpected behavior with CharField(required=False, min_length=X). Thanks for reporting, Benjamin Slavin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 23:07:41 +00:00
Adrian Holovaty 4f5170bffe newforms: The Form classes created by form_for_model() now have a create() method, which creates a model instance from the clean_data
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4216 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 22:33:24 +00:00
Adrian Holovaty 5cb093b033 newforms: Changed form_for_model() to ignore a field if its formfield() returns None, and changed AutoField.formfield() to return None
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4214 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 21:22:13 +00:00
Adrian Holovaty 6001974e45 newforms: Added initial implementation of form_for_model and form_for_fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 05:46:11 +00:00
Adrian Holovaty 0a7d8b18ff newforms: Split the Form class into BaseForm and Form. The former has all the Form logic; the latter just implements the metaclass that allows for declarative form definition. This change makes it easier to allow other (i.e., non-declarative) designation of a form's fields in creating a form class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 05:35:19 +00:00
Adrian Holovaty fc11b97e97 Fixed #3143 -- Added TimeField to newforms. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-14 20:35:32 +00:00
Adrian Holovaty d8a21981b7 Fixed #3139 -- newforms BoundField no longer returns empty errors when using a prefix. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 23:03:19 +00:00
Adrian Holovaty 6733c39804 Fixed #3112 -- Changed newforms Form.as_table() to use <th> instead of <td> for first column
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 06:44:57 +00:00
Adrian Holovaty 4add4e4272 Fixed #3114 -- newforms MultipleChoiceField now handles MultiValueDicts properly. Thanks for the patch, Honza Král
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4196 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 06:26:04 +00:00
Adrian Holovaty faaec9c28f Fixed #3132 -- Added prefix support for newforms. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-12 05:55:39 +00:00
Adrian Holovaty 05588b3797 newforms: Changed Form to use auto_id by default
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-11 02:38:18 +00:00
Adrian Holovaty d93021eb10 Fixed #3102 -- newforms: Fields can now designate their human-friendly labels. BoundField.verbose_name is now BoundField.label
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 20:06:12 +00:00
Adrian Holovaty f10a910577 newforms: Added Field.widget_attrs() hook, which lets a Field designate HTML attributes to use in its widget. Implemented CharField.widget_attrs(), which sets the HTML maxlength attribute for <input type='text'> and <input type='password'>. Thanks for the idea, Gary Doades
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 18:54:53 +00:00
Adrian Holovaty 4e72dc86ff Fixed small Unicode error in newforms. Thanks, Honza Král. Refs #3114
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 05:54:14 +00:00
Adrian Holovaty c50d333c23 newforms: Changed Form._html_output() to use dictionary-style format strings for more flexibility. Thanks, Waylan Limberg
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4182 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 15:49:05 +00:00
Adrian Holovaty b4a67359a3 newforms: Abstracted common code in Form as_table(), as_ul() and as_p() into Form._html_output(). It's slightly obscure but saves on a lot of redundancy and code bloat.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4179 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:59:07 +00:00
Adrian Holovaty 7e269bd390 Fixed #3107 -- newforms: Added Form.as_p()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4178 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:34:37 +00:00
Adrian Holovaty 44add112e5 newforms: Form.as_ul() no longer puts hidden fields between <li>s. Similar to [4175], which was the same thing for Form.as_table(). Refs #3101
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:17:06 +00:00
Adrian Holovaty 3d1ceab1aa newforms: Same fix as [4174], except for Form.as_table()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4176 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:10:31 +00:00
Adrian Holovaty 300f26deff Fixed #3101 -- newforms: Form.as_table() no longer puts hidden fields between <tr>s. Thanks for reporting, Eric
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:06:58 +00:00
Adrian Holovaty 88f1dd31b7 newforms: Small potential bugfix in Form.as_ul() -- called unicode() on BoundField rather than str()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 05:45:22 +00:00
Adrian Holovaty 12e9a84429 newforms: Changed Table.as_table() and Table.as_ul() to put hidden-form errors at the top of the output rather than in field order
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 05:35:39 +00:00
Adrian Holovaty 558e07a9bc newforms: Simplified BoundField._errors()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 05:19:01 +00:00
Adrian Holovaty e6d19257ba Fixed #3095 -- Added translation strings to newforms. Thanks for the patch, Honza Král
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4166 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-06 06:37:32 +00:00
Adrian Holovaty 6c0219cf72 newforms: Added __unicode__() methods wherever there were __str__() methods, and changed the __str__() methods to delegate to __unicode__().encode(settings.DEFAULT_CHARSET)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 20:08:27 +00:00
Adrian Holovaty a794acbd7a newforms: Removed DEFAULT_ENCODING import from fields.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4162 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 19:55:51 +00:00
Adrian Holovaty 460ccfc045 newforms: Changed BoundField form, field and name attributes to remove leading underscore to imply that they can be accessed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 18:48:49 +00:00
Adrian Holovaty 468993d13e newforms: Added check_test argument to CheckboxInput and changed its render() behavior slightly. Also changed CheckboxSelectMultiple to use checkboxes with the same name, rather than checkboxes with separate names
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 22:06:08 +00:00
Adrian Holovaty e130031fd2 Fixed #3082 -- newforms: Changed Form as_table() and as_ul() not to display verbose names for hidden fields, and to add field-name prefix to error messages to avoid user confusion. Also added unit tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 17:07:40 +00:00
Adrian Holovaty 4dca65cdfc newforms: Added BoundField.as_hidden()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 03:58:25 +00:00
Adrian Holovaty 61c93842f4 newforms: Added BoundField.data property
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 21:48:58 +00:00
Adrian Holovaty 4a3ad338d6 newforms: Added Widget.value_from_datadict hook, which allows a Widget to define how to convert its post data dictionary to a value. Implemented it for CheckboxSelectMultiple and updated unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 17:00:34 +00:00
Adrian Holovaty e6babbfe5f newforms: Added docstring to Widget.build_attrs()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 03:18:56 +00:00
Adrian Holovaty 4db61fb406 Fixed #3078 -- newforms: Added HTML escaping to label_tag() calls. Thanks, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 03:14:03 +00:00
Adrian Holovaty 8aae90c0e5 newforms: Implemented CheckboxSelectMultiple
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 03:02:26 +00:00
Adrian Holovaty fe4af48ec8 newforms: The <input> tags in a RadioSelect now each have a distinct ID. Also, this plays nicely with auto_id and <label>s for Form.as_table() and Form.as_ul(). Refs #3064
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 01:40:27 +00:00
Adrian Holovaty bb45c394a6 Fixed #3064 -- newforms: Added <label> support through BoundField.label_tag() method. Also added BoundField.verbose_name and added/updated unit tests. Thanks, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 00:49:27 +00:00
Adrian Holovaty 7c1cc5fb25 newforms: Small short-circuit optimization to BoundField.as_widget()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 05:02:21 +00:00