Skip to content

Commit

Permalink
allow to override cascade_forms one-by-one
Browse files Browse the repository at this point in the history
# Conflicts:
#	shop/conf.py
  • Loading branch information
jrief committed Oct 16, 2018
1 parent 08c88ee commit e5b5cd0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions shop/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,26 @@ def SHOP_DIALOG_FORMS(self):
"""
return self._setting('SHOP_DIALOG_FORMS', [])

@property
def SHOP_CASCADE_FORMS(self):
"""
Specify a map of Django Form classes to be used by the Cascade plugins used for the
checkout view. Override this map, if the Cascade plugins shall use a Form other than the
ones provided.
"""
cascade_forms = {
'CustomerForm': 'shop.forms.checkout.CustomerForm',
'GuestForm': 'shop.forms.checkout.GuestForm',
'ShippingAddressForm': 'shop.forms.checkout.ShippingAddressForm',
'BillingAddressForm': 'shop.forms.checkout.BillingAddressForm',
'PaymentMethodForm': 'shop.forms.checkout.PaymentMethodForm',
'ShippingMethodForm': 'shop.forms.checkout.ShippingMethodForm',
'ExtraAnnotationForm': 'shop.forms.checkout.ExtraAnnotationForm',
'AcceptConditionForm': 'shop.forms.checkout.AcceptConditionForm',
}
cascade_forms.update(self._setting('SHOP_CASCADE_FORMS', {}))
return cascade_forms

def __getattr__(self, key):
if not key.startswith('SHOP_'):
key = 'SHOP_' + key
Expand Down

0 comments on commit e5b5cd0

Please sign in to comment.