I tried in the view:
filter_string = "delivery_time__lte=time_avail_hours,
abbrev__contains='SC'"
formShip = ShippingMethodForm(filter_string)
Then the form def is:
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, *args, **kwargs):
super(ShippingMethodForm, self).__init__(*args, **kwargs)
self.fields["ship_method"].queryset =
ShippingMethod.objects.filter(filter_string)
Doesn't work, I get NameError ....global name 'filter_string' is not
defined
Also this is the GET portion of the view, so putting request.POST in
there is not appropriate.