Opened 18 years ago
Closed 17 years ago
#4622 closed (fixed)
SelectDateWidget doesn't accept its as_hidden rendering
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
An apparently little-known fact about widgets that implement get_value_from_datadict is that they need to be able to accept whatever the widget returns for its "as_hidden" value as input. Otherwise, a form that uses as_hidden to propogate values from previous forms will fail:
>>> a = GetDate({'mydate_month':'4', 'mydate_day':'1', 'mydate_year':'2008'}) >>> print a['mydate'].as_hidden() <input type="hidden" name="mydate" value="2008-4-1" id="id_mydate" /> >>> b=GetDate({'mydate':'2008-4-1'}) >>> print b.is_valid() False
The attached diff has a fix for this problem, and a test.
Attachments (1)
Change History (4)
by , 18 years ago
Attachment: | SelectDateWidget.diff added |
---|
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
1:29 code:test ratio? how very agile of you :)
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
A one-line diff and 29 lines of test ;-)