From 8c34c7498aeaad524e6602e6a7a1a3ab62406655 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Mon, 22 Aug 2016 10:13:02 +1000 Subject: [PATCH] Factors _ProductsForm into _HasProductsFields --- registrasion/forms.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/registrasion/forms.py b/registrasion/forms.py index 68302f56..f7157c82 100644 --- a/registrasion/forms.py +++ b/registrasion/forms.py @@ -47,7 +47,7 @@ class ManualPaymentForm(forms.ModelForm): # Products forms -- none of these have any fields: they are to be subclassed # and the fields added as needs be. -class _ProductsForm(forms.Form): +class _HasProductsFields(object): PRODUCT_PREFIX = "product_" @@ -57,7 +57,7 @@ class _ProductsForm(forms.Form): initial = self.initial_data(k["product_quantities"]) k["initial"] = initial del k["product_quantities"] - super(_ProductsForm, self).__init__(*a, **k) + super(_ProductsFieldsHelpers, self).__init__(*a, **k) @classmethod def field_name(cls, product): @@ -81,6 +81,10 @@ class _ProductsForm(forms.Form): return iter([]) +class _ProductsForm(_HasProductsFields, forms.Form): + pass + + class _QuantityBoxProductsForm(_ProductsForm): ''' Products entry form that allows users to enter quantities of desired products. '''