mirror of
https://github.com/django/django.git
synced 2025-12-02 16:16:01 +00:00
Fixed #27800 -- Fixed QuerySet.annotate(Length(...)).distinct() crash.
This commit is contained in:
parent
84126f2789
commit
ac5f886c56
3 changed files with 13 additions and 2 deletions
|
|
@ -1329,7 +1329,12 @@ class Query:
|
|||
"querying. If it is a GenericForeignKey, consider "
|
||||
"adding a GenericRelation." % name
|
||||
)
|
||||
model = field.model._meta.concrete_model
|
||||
try:
|
||||
model = field.model._meta.concrete_model
|
||||
except AttributeError:
|
||||
# QuerySet.annotate() may introduce fields that aren't
|
||||
# attached to a model.
|
||||
model = None
|
||||
else:
|
||||
# We didn't find the current field, so move position back
|
||||
# one step.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue