mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
Remove duplicate code _find_rhs_lhs_subquery (#190)
This commit is contained in:
parent
c2696398a8
commit
9d528656d5
2 changed files with 1 additions and 18 deletions
|
|
@ -8,6 +8,7 @@ What’s new in django-cachalot?
|
|||
and `CACHALOT_UNCACHABLE_APPS` (#187)
|
||||
- Drop support for Django 3.0 (#189)
|
||||
- (Internal) Added Django main-branch CI on cron job
|
||||
- (Internal) Removed duplicate code (#190)
|
||||
|
||||
2.4.1
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -118,24 +118,6 @@ def _find_rhs_lhs_subquery(side):
|
|||
raise UncachableQuery
|
||||
|
||||
|
||||
def _find_rhs_lhs_subquery(side):
|
||||
h_class = side.__class__
|
||||
if h_class is Query:
|
||||
return side
|
||||
elif h_class is QuerySet:
|
||||
return side.query
|
||||
elif h_class in (Subquery, Exists): # Subquery allows QuerySet & Query
|
||||
try:
|
||||
return side.query.query if side.query.__class__ is QuerySet else side.query
|
||||
except AttributeError: # TODO Remove try/except closure after drop Django 2.2
|
||||
try:
|
||||
return side.queryset.query
|
||||
except AttributeError:
|
||||
return None
|
||||
elif h_class in UNCACHABLE_FUNCS:
|
||||
raise UncachableQuery
|
||||
|
||||
|
||||
def _find_subqueries_in_where(children):
|
||||
for child in children:
|
||||
child_class = child.__class__
|
||||
|
|
|
|||
Loading…
Reference in a new issue