#7195 closed (fixed)
MultipleChoice fields don't validate when using request.REQUEST
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
MultipleChoice fields always give a validation error if you instantiate the form using data from request.REQUEST rather than request.POST.
This is because the SelectMultiple widget only uses the getlist() method if the data dictionary is a MultiValueDict, whereas request.REQUEST is a MergeDict.
Patch and tests attached.
Attachments (1)
Change History (6)
by , 17 years ago
Attachment: | mergedict.diff added |
---|
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 16 years ago
milestone: | → 1.0 |
---|---|
Patch needs improvement: | set |
comment:3 by , 16 years ago
I'm not really worried about people passing in a MergeDict of arbitrary dictionaries here. We don't need to publicly support every type of possible data structures, just the normal dictionary case and anything that Django might have to pass in internally. So this approach is fine.
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I have one objection about the patch: It always treats a MergeDict like a MultiValueDict. But a MergeDict does not need to be merging MultiValueDicts. If it merges normal dicts, the patch is not appropriate.
Anyway, this is a bug so ==> milestone 1.0