For the record, here's what works:

In views.py:

if country == 'Canada':
            delivery_time__lte=time_avail_hours
            abbrev__contains='SC'

formShip = ShippingMethodForm(delivery_time__lte, abbrev__contains)


Then in models.py:

class ShippingMethodForm(forms.Form):
    # tricky thing done here to change queryset based on ticket date
and destination
    ship_method = forms.ModelChoiceField
(queryset=ShippingMethod.objects.none())
    def __init__(self, delivery_time__lte, abbrev__contains, *args,
**kwargs):
        super(ShippingMethodForm, self).__init__(*args, **kwargs)
        self.fields["ship_method"].queryset =
ShippingMethod.objects.filter(
                   delivery_time__lte=delivery_time__lte,
                   abbrev__contains=abbrev__contains
         )



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to