From f5c6d3c8d9fa2158734858fa0a7ac917c384cb97 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 18 Aug 2016 17:55:47 -0700 Subject: Fixed #27068 -- Unified form field initial data retrieval. --- docs/ref/forms/api.txt | 8 ++++++++ docs/releases/1.11.txt | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'docs') 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:: Url: Comment: +.. 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 ` attribute allows specifying the Python value to use to represent "empty". +* The new :meth:`Form.get_initial_for_field() + ` method returns initial data for a + form field. + Generic Views ~~~~~~~~~~~~~ -- cgit v1.3