From 4dca65cdfc1e206fac323bd8afae9ae1fccc9dac Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 30 Nov 2006 03:58:25 +0000 Subject: newforms: Added BoundField.as_hidden() git-svn-id: http://code.djangoproject.com/svn/django/trunk@4145 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/tests.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/regressiontests/forms') diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index 40c49067af..bfa9d07237 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -1436,11 +1436,14 @@ Any Field can have a Widget class passed to its constructor: >>> print f['message'] -as_textarea() and as_text() are shortcuts for changing the output widget type: +as_textarea(), as_text() and as_hidden() are shortcuts for changing the output +widget type: >>> f['subject'].as_textarea() u'' >>> f['message'].as_text() u'' +>>> f['message'].as_hidden() +u'' The 'widget' parameter to a Field can also be an instance: >>> class ContactForm(Form): @@ -1450,7 +1453,8 @@ The 'widget' parameter to a Field can also be an instance: >>> print f['message'] -Instance-level attrs are *not* carried over to as_textarea() and as_text(): +Instance-level attrs are *not* carried over to as_textarea(), as_text() and +as_hidden(): >>> f['message'].as_text() u'' >>> f = ContactForm({'subject': 'Hello', 'message': 'I love you.'}) @@ -1458,6 +1462,8 @@ u'' u'' >>> f['message'].as_text() u'' +>>> f['message'].as_hidden() +u'' For a form with a