mirror of
				https://github.com/django/django.git
				synced 2025-10-28 08:06:09 +00:00 
			
		
		
		
	Fixed #7753: clean NullBooleanField correctly when using HiddenInput. Thanks to julien and ElliottM.
				
					
				
			git-svn-id: http://code.djangoproject.com/svn/django/trunk@8661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -594,7 +594,18 @@ class NullBooleanField(BooleanField): | ||||
|     widget = NullBooleanSelect | ||||
|  | ||||
|     def clean(self, value): | ||||
|         return {True: True, False: False}.get(value, None) | ||||
|         """ | ||||
|         Explicitly checks for the string 'True' and 'False', which is what a | ||||
|         hidden field will submit for True and False. Unlike the | ||||
|         Booleanfield we also need to check for True, because we are not using | ||||
|         the bool() function | ||||
|         """ | ||||
|         if value in (True, 'True'): | ||||
|             return True | ||||
|         elif value in (False, 'False'): | ||||
|             return False | ||||
|         else: | ||||
|             return None | ||||
|  | ||||
| class ChoiceField(Field): | ||||
|     widget = Select | ||||
|   | ||||
		Reference in New Issue
	
	Block a user