> 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
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)
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
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
4 matches
Mail list logo