Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-09-13 Thread The Boss
> I generally do something like: > > class OrderForm(ModelForm): >     def __init__(self, *args, **kw): >         ordernumber = '%06d' % kw.pop('ordernumber', 0) >         super(OrderForm, self).__init__(*args, **kw) >         self.fields['associated_files'].queryset = >             ArchivedFile.ob

Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-27 Thread Karen Tracey
On Thu, Aug 26, 2010 at 11:09 PM, The Boss wrote: > This should really be much easier. I generally do something like: class OrderForm(ModelForm): def __init__(self, *args, **kw): ordernumber = '%06d' % kw.pop('ordernumber', 0) super(OrderForm, self).__init__(*args, **kw)

Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
Ok, I sort of found a solution. After much digging and looking at class dictionaries I found that i could manually update the dictionary self.base_fields. self.base_fields['associated_files'] =self.__class__.associated_files It's seems that class attrs assigned in init do not get added t

ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
The documentation made this seem trivial but I must be missing something. I have an order form with a many to many field to ArchivedFiles. I want to just show file choices that start with the order number given to the form at instantiation. I almost works. class OrderForm(ModelForm): def __ini