#32917: Add an internal _value_from_datadict() method to BaseForm
-------------------------------------+-------------------------------------
Reporter: Chris | Owner: Chris Jerdonek
Jerdonek |
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: dev
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
I noticed that some call sites can be simplified if an internal method
called something like `_value_from_datadict()` is added to `BaseForm`.
Here is one of the call sites:
https://github.com/django/django/blob/6f60fa97b0b501ef7cc77e16392654bf27ec8db3/django/forms/boundfield.py#L121
Its implementation can look something like this:
{{{#!python
def _value_from_datadict(self, field, html_name):
return field.widget.value_from_datadict(self.data, self.files,
html_name)
}}}
One reason this is nicer is that callers don't have to know about the
form's `self.data` and `self.files` dicts. They can just access a method
on the form, which encapsulates the data dictionaries.
--
Ticket URL: <https://code.djangoproject.com/ticket/32917>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.f7f999b73b4189e698bbb7be3e102834%40djangoproject.com.