mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
Locally import FilteredRelation for Django 1.11 compatibility.
This commit is contained in:
parent
861f20ed67
commit
109f06077e
1 changed files with 3 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ from django.contrib.auth.models import Group, Permission, User
|
|||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import (
|
||||
connection, transaction, DEFAULT_DB_ALIAS, ProgrammingError)
|
||||
from django.db.models import Count, FilteredRelation, Q
|
||||
from django.db.models import Count, Q
|
||||
from django.db.models.expressions import RawSQL, Subquery, OuterRef, Exists
|
||||
from django.db.models.functions import Now
|
||||
from django.db.transaction import TransactionManagementError
|
||||
|
|
@ -485,6 +485,8 @@ class ReadTestCase(TestUtilsMixin, TransactionTestCase):
|
|||
@skipIf(django_version < (2, 0),
|
||||
'`FilteredRelation` was introduced in Django 2.0.')
|
||||
def test_filtered_relation(self):
|
||||
from django.db.models import FilteredRelation
|
||||
|
||||
qs = TestChild.objects.annotate(
|
||||
filtered_permissions=FilteredRelation(
|
||||
'permissions', condition=Q(permissions__pk__gt=1)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue