Can you really execute a subquery on the QuerySet using another QuerySet?

For instance:

q = Something.objects.filter(x=y).extra(where=query_set2)

Short answer: No. The [cde] method does not expect querysets to become passed in.

Should you consider it a little, it seems sensible. Querysets are an abstraction accustomed to represent the outcomes of the fetch operation around the database and extra is really a convenient method of affixing custom fields in the database to some queryset. Unless of course you alter the essential character of extra to mean "custom blocking with another queryset" this can not work.

I might understand your question in 2 ways.

  1. You are able to specify multiple variables inside your filter parameters, for example :

    extra
  2. You need to make what's known as a "join" in SQL. You can do this through the aggregation system of Django, begin to see the official Django Official Documentation.