Backport of https://docs.djangoproject.com/en/dev/ref/models/expressions/#subquery-expressions to support legacy Django versions.
$ pip install django-subquery
Please see the official Django documentation: https://docs.djangoproject.com/en/dev/ref/models/expressions/#subquery-expressions
Note that you need to import from django_subquery.expressions
instead of django.db.models
.
This package is in production use with Django 1.8, but should work with any version of Django from 1.8 onwards.
This package is not likely to work on Oracle, as that required some backend within django to work.
The main class used to be called SubQuery
, but was renamed Subquery
when merged into Django 1.11.
You'll need to adjust your code accordingly.