Replies: 1 comment
-
@heckad companies = DjangoFilterConnectionField(fields.CompanyType)
def resolve_companies(self, args):
with_appeal_status = args.get('with_appeal_status')
companies_with_approved_appeals = Company.objects.annotate(
num_approved_appeals=Count('appeal', filter=Q(appeal__status__in=with_appeal_status))
).filter(num_approved_appeals__gt=0)
return companies_with_approved_appeals |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have
Appeal
andCompany
model. EachAppeal
has a foreign key toCompany
and some fields witch able for filtering.Example models
Example
DjangoObjectType
Query
I want to write query which returns only objects with appeals which satisfy a condition
Example query
Now this query returns all companies and some of them have empty appeals. I want to exclude such companies from response. How to do it?
Beta Was this translation helpful? Give feedback.
All reactions