mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.8.x] Fixed #25215 -- Solved reference to forms.HStoreField in declaration of HStoreField
Correct test which was using the model field in a test form.
Backport of 9f73009e98 from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Markus Holtermann
						Markus Holtermann
					
				
			
			
				
	
			
			
			
						parent
						
							7a8460191e
						
					
				
				
					commit
					473af19273
				
			| @@ -181,12 +181,21 @@ class TestFormField(TestCase): | ||||
|         form_field = model_field.formfield() | ||||
|         self.assertIsInstance(form_field, forms.HStoreField) | ||||
|  | ||||
|     def test_empty_field_has_not_changed(self): | ||||
|     def test_field_has_changed(self): | ||||
|         class HStoreFormTest(Form): | ||||
|             f1 = HStoreField() | ||||
|             f1 = forms.HStoreField() | ||||
|         form_w_hstore = HStoreFormTest() | ||||
|         self.assertFalse(form_w_hstore.has_changed()) | ||||
|  | ||||
|         form_w_hstore = HStoreFormTest({'f1': '{"a": 1}'}) | ||||
|         self.assertTrue(form_w_hstore.has_changed()) | ||||
|  | ||||
|         form_w_hstore = HStoreFormTest({'f1': '{"a": 1}'}, initial={'f1': '{"a": 1}'}) | ||||
|         self.assertFalse(form_w_hstore.has_changed()) | ||||
|  | ||||
|         form_w_hstore = HStoreFormTest({'f1': '{"a": 2}'}, initial={'f1': '{"a": 1}'}) | ||||
|         self.assertTrue(form_w_hstore.has_changed()) | ||||
|  | ||||
|  | ||||
| class TestValidator(TestCase): | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user