[Answer]-Django model how to add filter condition of through model field

1👍

Instead of termrelation_set__term_type, try termrelation__term_type. Taking the hint from official documentation

As you are using an intermediate model, you can also query on its attributes:

# Find all the members of the Beatles that joined after 1 Jan 1961
>>> Person.objects.filter(
...     group__name='The Beatles',
...     membership__date_joined__gt=date(1961,1,1))
[<Person: Ringo Starr]

Leave a comment