I'm trying to filter a table in django based on the value of a particular field of a foreign key.
For example I have two models - Project and Asset, Project has a "name" field and each asset has a ForiegnKey(Project) field. I'd like to filter my asset list based on the name of the associated project.
Currently I am performing two queries...
project_list = Project.objects.filter(name__contains="Foo")
asset_list = Asset.objects.filter( desc__contains=filter, project__in=project_list).order_by('desc')
but i'm wondering if there is a way to specify this kind of filtering in the main query?