From 9ac97e7eb5a74f813012715c7598c8608e78e178 Mon Sep 17 00:00:00 2001 From: David Smith <39445562+smithdc1@users.noreply.github.com> Date: Wed, 7 Dec 2022 09:49:45 +0000 Subject: [PATCH] Refs #32339 -- Updated Form API docs to prefer as_div() output style. --- docs/ref/forms/api.txt | 145 +++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 85 deletions(-) diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 0d526d26aa..6d296c537e 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -342,23 +342,23 @@ attribute:: >>> f.fields['name'] -You can alter the field of :class:`Form` instance to change the way it is -presented in the form:: +You can alter the field and :class:`.BoundField` of :class:`Form` instance to +change the way it is presented in the form:: - >>> f.as_table().split('\n')[0] - 'Name:' - >>> f.fields['name'].label = "Username" - >>> f.as_table().split('\n')[0] - 'Username:' + >>> f.as_div().split("")[0] + '
' + >>> f["subject"].label = "Topic" + >>> f.as_div().split("
")[0] + '
' Beware not to alter the ``base_fields`` attribute because this modification will influence all subsequent ``ContactForm`` instances within the same Python process:: - >>> f.base_fields['name'].label = "Username" + >>> f.base_fields["subject"].label_suffix = "?" >>> another_f = CommentForm(auto_id=False) - >>> another_f.as_table().split('\n')[0] - 'Username:' + >>> f.as_div().split("
")[0] + '
' Accessing "clean" data ====================== @@ -782,42 +782,22 @@ If ``auto_id`` is ``False``, then the form output will not include ``