Skip to content

Instantly share code, notes, and snippets.

@joshcartme
Created September 10, 2012 18:20
Show Gist options
  • Save joshcartme/3692706 to your computer and use it in GitHub Desktop.
Save joshcartme/3692706 to your computer and use it in GitHub Desktop.
Cartridge OrderForm to work with cartridge-tax
from django.contrib.localflavor.us.forms import USStateSelect
from cartridge.shop import checkout
from cartridge.shop.forms import OrderForm
from mezzanine.conf import settings
class OrderForm(OrderForm):
def __init__(self, request, step, *args,**kwrds):
first = step == checkout.CHECKOUT_STEP_FIRST
super(OrderForm, self).__init__(request, step, *args, **kwrds)
if settings.SHOP_CHECKOUT_STEPS_SPLIT:
if first:
self.fields['billing_detail_state'].widget = USStateSelect()
self.fields['shipping_detail_state'].widget = USStateSelect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment