Re: ModelForm limit m2m choices

2009-08-13 Thread alain31
Hi, sorry for the first duplicate and incomplete posts (eepc keyboard ...) My problem actually was to pass an dynamic argument to define queryset 'somevalue' (because ModelForm uses class atributes...). I solved it writing a function: def getModel(somevalue) class MyForm(ModelForm) my

Re: ModelForm limit m2m choices

2009-08-13 Thread spacetaxi
Hello alain31, On 12 Aug., 21:41, alain31 wrote: > [...] > How can I use a custom QuerySet for the choices of field1  ? I think it should work like this: myform = MyForm(..) myqueryset = myform.base_fields['field1'].queryset myqueryset = myqueryset.filter_by(somefield='somevalue') myform.b