Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
e1f13f15
Kaydet (Commit)
e1f13f15
authored
Nis 12, 2018
tarafından
Flávio Juvenal
Kaydeden (comit)
Tim Graham
Nis 13, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29320 -- Added an exception when an annotation alias matches a ForeignKey attname.
üst
78f8b80f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
query.py
django/db/models/query.py
+5
-1
tests.py
tests/aggregation_regress/tests.py
+5
-0
No files found.
django/db/models/query.py
Dosyayı görüntüle @
e1f13f15
...
...
@@ -7,6 +7,7 @@ import operator
import
warnings
from
collections
import
OrderedDict
,
namedtuple
from
functools
import
lru_cache
from
itertools
import
chain
from
django.conf
import
settings
from
django.core
import
exceptions
...
...
@@ -981,7 +982,10 @@ class QuerySet:
clone
=
self
.
_chain
()
names
=
self
.
_fields
if
names
is
None
:
names
=
{
f
.
name
for
f
in
self
.
model
.
_meta
.
get_fields
()}
names
=
set
(
chain
.
from_iterable
(
(
field
.
name
,
field
.
attname
)
if
hasattr
(
field
,
'attname'
)
else
(
field
.
name
,)
for
field
in
self
.
model
.
_meta
.
get_fields
()
))
for
alias
,
annotation
in
annotations
.
items
():
if
alias
in
names
:
...
...
tests/aggregation_regress/tests.py
Dosyayı görüntüle @
e1f13f15
...
...
@@ -769,6 +769,11 @@ class AggregationTests(TestCase):
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
Author
.
objects
.
annotate
(
friends
=
Count
(
'friends'
))
def
test_fk_attname_conflict
(
self
):
msg
=
"The annotation 'contact_id' conflicts with a field on the model."
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
Book
.
objects
.
annotate
(
contact_id
=
F
(
'publisher_id'
))
def
test_values_queryset_non_conflict
(
self
):
# Regression for #14707 -- If you're using a values query set, some potential conflicts are avoided.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment