From 2afa6a8d79eba69ce6fd5cc4e0efae5f2e6e8002 Mon Sep 17 00:00:00 2001
From: Christopher Neugebauer <chrisjrn@gmail.com>
Date: Mon, 25 Apr 2016 16:16:41 +1000
Subject: [PATCH] =?UTF-8?q?Adds=20=E2=80=9CNO=20SELECTION=E2=80=9D=20to=20?=
 =?UTF-8?q?radio=20buttons=20form.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #32.
---
 registrasion/forms.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/registrasion/forms.py b/registrasion/forms.py
index 14fa3ec0..68302f56 100644
--- a/registrasion/forms.py
+++ b/registrasion/forms.py
@@ -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,