mirror of
				https://github.com/django/django.git
				synced 2025-10-30 17:16:10 +00:00 
			
		
		
		
	Fixes #10427 -- Abstract the value generation of a BoundField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14734 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -1151,6 +1151,21 @@ class FormsTestCase(TestCase): | ||||
| <option value="w">whiz</option> | ||||
| </select></li>""") | ||||
|  | ||||
|     def test_boundfield_values(self): | ||||
|         # It's possible to get to the value which would be used for rendering | ||||
|         # the widget for a field by using the BoundField's value method. | ||||
|   | ||||
|         class UserRegistration(Form): | ||||
|             username = CharField(max_length=10, initial='djangonaut') | ||||
|             password = CharField(widget=PasswordInput) | ||||
|  | ||||
|         unbound = UserRegistration() | ||||
|         bound = UserRegistration({'password': 'foo'}) | ||||
|         self.assertEqual(bound['username'].value(), None) | ||||
|         self.assertEqual(unbound['username'].value(), 'djangonaut') | ||||
|         self.assertEqual(bound['password'].value(), 'foo') | ||||
|         self.assertEqual(unbound['password'].value(), None) | ||||
|  | ||||
|     def test_help_text(self): | ||||
|         # You can specify descriptive text for a field by using the 'help_text' argument) | ||||
|         class UserRegistration(Form): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user