hi,

I'm on django 1.3 using class based generic views.

So in my use case, i have a modelForm defined with custom fields.
something along the lines of

class MF_B(forms.ModelForm):
    stuff = forms.MultipleChoiceField(queryset=None, required=False)
    class Meta:
        model=B

as the code above implies, I want to populate the stuff choices here
with a queryset.

Model B also has a foreign key to Model A such that i would call
inlineformset_factor like so:
AB_Formset = inlineformset_factory(A, B, form=MF_B, max_num=3,
formfield_callback=self.get_field_qs)

Just pretend get_field_qs is in scope and what we are trying to do
here is something like:
http://stackoverflow.com/questions/7310861/django-passing-parameters-to-inline-formset

My expectation here is that get_field_qs would get called for ALL
fields on the form (i.e. including my custom fields on the
ModelForm).
That doesn't happen.
Looking at the django code, if i go to
django/forms/models.py -> def fields_for_model -> line 146

It appears that formfield_callback will  get executed for fields on
model ONLY.

Because the name of the parameter is formfield_callback, I would
expect get_field_qs would be called for all the fields.
As a result I feel this is a bug.

Would like to hear comments from the developer community.
Thanks!


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

Reply via email to