diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2016-08-18 17:55:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-18 17:55:47 -0700 |
| commit | f5c6d3c8d9fa2158734858fa0a7ac917c384cb97 (patch) | |
| tree | 0f3846b3df6a78c674d3ef048235d5604d469186 /docs | |
| parent | 13857b45ca54a519a58361238442af84262c0d23 (diff) | |
Fixed #27068 -- Unified form field initial data retrieval.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/forms/api.txt | 8 | ||||
| -rw-r--r-- | docs/releases/1.11.txt | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 094be3a565..8849ce284d 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -248,6 +248,14 @@ precedence:: <tr><th>Url:</th><td><input type="url" name="url" required /></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" required /></td></tr> +.. method:: Form.get_initial_for_field(field, field_name) + +.. versionadded:: 1.11 + +Use :meth:`~Form.get_initial_for_field()` to retrieve initial data for a form +field. It retrieves data from :attr:`Form.initial` and :attr:`Field.initial`, +in that order, and evaluates any callable initial values. + Checking which form data has changed ==================================== diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index c8fc03c2b6..41baeb40dd 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -187,6 +187,10 @@ Forms * The new :attr:`CharField.empty_value <django.forms.CharField.empty_value>` attribute allows specifying the Python value to use to represent "empty". +* The new :meth:`Form.get_initial_for_field() + <django.forms.Form.get_initial_for_field>` method returns initial data for a + form field. + Generic Views ~~~~~~~~~~~~~ |
