Opened 8 years ago
Closed 8 years ago
#26905 closed Cleanup/optimization (fixed)
Add possibility to pass MultiValueDict-like objects as a form's data
Reported by: | Marcin Nowak | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
value_from_datadict()
of django.forms.widgets.MultipleHiddenInput
and django.forms.widgets.SelectMultiple
are not based on duck typing but on a strict checking for MultiValueDict
class.
Changing implementation to duck typing will make code more flexible and open doors for passing any dict-like and MultiValueDict-like objects as a form's data.
Forms data passed as MultiValueDict
class should be slightly faster due to less type checkings, but this is not a goal itself.
The discussion I've started about this improvement is here: https://groups.google.com/d/msg/django-developers/v-pk2l0hxHk/Vn-hEjMjAwAJ
I'm attaching a patch proposal.
Attachments (1)
Change History (4)
by , 8 years ago
Attachment: | 0001-Added-possibility-to-use-any-MultiValueDict-like-obj.patch added |
---|
comment:1 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Can you send a pull request with that patch?
comment:2 by , 8 years ago
Yes, here you are - https://github.com/django/django/pull/6932
(sorry for late reply)
Duck typing proposal for value_from_datadict()