Update YesNoField coercion
I am not sure if this is related to a py2/py3 change, or if it's because django 1.11 changed the way it handles booleans; but either way, this works.
This commit is contained in:
		
							parent
							
								
									271d9e05cd
								
							
						
					
					
						commit
						9d7be5f6df
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -9,7 +9,7 @@ class YesNoField(forms.TypedChoiceField): | ||||||
|         kwargs['required'] = True |         kwargs['required'] = True | ||||||
|         super(YesNoField, self).__init__( |         super(YesNoField, self).__init__( | ||||||
|             *args, |             *args, | ||||||
|             coerce=lambda x: x is True, |             coerce=lambda x: x in ['True', 'Yes', True], | ||||||
|             choices=((None, '--------'), (False, 'No'), (True, 'Yes')), |             choices=((None, '--------'), (False, 'No'), (True, 'Yes')), | ||||||
|             **kwargs |             **kwargs | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley