Using a backwards relation (i.e FOO_set) for ModelChoiceField in Django
- by Bwmat
I have a model called Movie, which has a ManyToManyField called director to a model called Person, and I'm trying to create a form with ModelChoiceField like so:
class MovieSearchForm(forms.Form):
producer = forms.ModelChoiceField(label='Produced by',
queryset=movies.models.Person.producer_set,
…