Changeset - 17dd91d56bf4
[Not reviewed]
0 1 0
Christopher Neugebauer - 8 years ago 2016-09-05 04:45:51
chrisjrn@gmail.com
Fixes bug in the t-shirt-style widget.
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
registrasion/forms.py
Show inline comments
...
 
@@ -331,24 +331,32 @@ class _ItemQuantityProductsFormSet(_HasProductsFields, forms.BaseFormSet):
 
                        "You may only choose each product type once.",
 
                    )
 
                products.add(product)
 
                yield product, quantity
 

	
 
        for product in (all_products - products):
 
            yield product, 0
 

	
 
    def add_product_error(self, product, error):
 
        for form in self.forms:
 
            form.add_product_error(product, error)
 

	
 
    @property
 
    def errors(self):
 
        _errors = super(_ItemQuantityProductsFormSet, self).errors
 
        if False not in [not form.errors for form in self.forms]:
 
            return []
 
        else:
 
            return _errors
 

	
 

	
 
class VoucherForm(forms.Form):
 
    voucher = forms.CharField(
 
        label="Voucher code",
 
        help_text="If you have a voucher code, enter it here",
 
        required=False,
 
    )
 

	
 

	
 
def staff_products_form_factory(user):
 
    ''' Creates a StaffProductsForm that restricts the available products to
 
    those that are available to a user. '''
0 comments (0 inline, 0 general)