mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Thank you to Mariusz Felisiak and Natalia Bidart for the reviews.
This commit is contained in:
committed by
Sarah Boyce
parent
39828fa778
commit
97d48cd3c6
@@ -175,6 +175,19 @@ class Q(tree.Node):
|
||||
def __hash__(self):
|
||||
return hash(self.identity)
|
||||
|
||||
@cached_property
|
||||
def referenced_base_fields(self):
|
||||
"""
|
||||
Retrieve all base fields referenced directly or through F expressions
|
||||
excluding any fields referenced through joins.
|
||||
"""
|
||||
# Avoid circular imports.
|
||||
from django.db.models.sql import query
|
||||
|
||||
return {
|
||||
child.split(LOOKUP_SEP, 1)[0] for child in query.get_children_from_q(self)
|
||||
}
|
||||
|
||||
|
||||
class DeferredAttribute:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user