parent
							
								
									00f87e30b7
								
							
						
					
					
						commit
						2afa6a8d79
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		|  | @ -133,6 +133,9 @@ class _RadioButtonProductsForm(_ProductsForm): | |||
|             choice_text = "%s -- $%d" % (product.name, product.price) | ||||
|             choices.append((product.id, choice_text)) | ||||
| 
 | ||||
|         if not category.required: | ||||
|             choices.append((0, "No selection")) | ||||
| 
 | ||||
|         cls.base_fields[cls.FIELD] = forms.TypedChoiceField( | ||||
|             label=category.name, | ||||
|             widget=forms.RadioSelect, | ||||
|  | @ -156,6 +159,8 @@ class _RadioButtonProductsForm(_ProductsForm): | |||
|         ours = self.cleaned_data[self.FIELD] | ||||
|         choices = self.fields[self.FIELD].choices | ||||
|         for choice_value, choice_display in choices: | ||||
|             if choice_value == 0: | ||||
|                 continue | ||||
|             yield ( | ||||
|                 choice_value, | ||||
|                 1 if ours == choice_value else 0, | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Christopher Neugebauer
						Christopher Neugebauer