I am trying to figure out a reasonable way to filter using a queryset
within a ModelForm.
In a simple example, I have three models (A, B, and C).
C has many A and B
A and B have a many to many relationship.
Assume that some instances of C and instances of B already exist.
I am using the create_object generic view to allow users to create
instances of A but not to select associated Bs. I'm then using
update_object generic view to allow users to select the Bs associated
with A. I've created a class that inherits from forms.ModelForm that
defines the form. In that I have forms.ModelMultipleChoiceField() for
selecting associated Bs. What I want to do is use the queryset to
filter to only show those Bs that share C with this instance of A.
I am confused as to how to do this type of query while passing a
form_class from the update_object generic view.
I have tried doing this in __init__() but I get a TypeError that the
form is not callable when I try to pass arguments.
Thanks in advance for your help and time,
-- Casey
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.