You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forms.py 609B

12345678910111213141516171819
  1. from django import forms
  2. from django.db.models import get_model
  3. class ShippingAddressForm(forms.ModelForm):
  4. def __init__(self, *args, **kwargs):
  5. super(ShippingAddressForm,self ).__init__(*args, **kwargs)
  6. self.set_country_queryset()
  7. def set_country_queryset(self):
  8. self.fields['country'].queryset = get_model('address', 'country')._default_manager.filter(is_shipping_country=True)
  9. class Meta:
  10. model = get_model('order', 'shippingaddress')
  11. exclude = ('user', 'search_text')
  12. # The BillingAddress form is in oscar.apps.payment.forms