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
f021c110
Kaydet (Commit)
f021c110
authored
Ock 14, 2019
tarafından
Nasir Hussain
Kaydeden (comit)
Tim Graham
Ock 15, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30099 -- Fixed invalid SQL when filtering a Subquery by an aggregate.
üst
87bf35ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
AUTHORS
AUTHORS
+1
-0
expressions.py
django/db/models/expressions.py
+1
-0
tests.py
tests/expressions/tests.py
+12
-0
No files found.
AUTHORS
Dosyayı görüntüle @
f021c110
...
@@ -618,6 +618,7 @@ answer newbie questions, and generally made Django that much better:
...
@@ -618,6 +618,7 @@ answer newbie questions, and generally made Django that much better:
Mykola Zamkovoi <nickzam@gmail.com>
Mykola Zamkovoi <nickzam@gmail.com>
Nagy Károly <charlie@rendszergazda.com>
Nagy Károly <charlie@rendszergazda.com>
Nasimul Haque <nasim.haque@gmail.com>
Nasimul Haque <nasim.haque@gmail.com>
Nasir Hussain <nasirhjafri@gmail.com>
Natalia Bidart <nataliabidart@gmail.com>
Natalia Bidart <nataliabidart@gmail.com>
Nate Bragg <jonathan.bragg@alum.rpi.edu>
Nate Bragg <jonathan.bragg@alum.rpi.edu>
Neal Norwitz <nnorwitz@google.com>
Neal Norwitz <nnorwitz@google.com>
...
...
django/db/models/expressions.py
Dosyayı görüntüle @
f021c110
...
@@ -994,6 +994,7 @@ class Subquery(Expression):
...
@@ -994,6 +994,7 @@ class Subquery(Expression):
query which will be resolved when it is applied to that query.
query which will be resolved when it is applied to that query.
"""
"""
template
=
'(
%(subquery)
s)'
template
=
'(
%(subquery)
s)'
contains_aggregate
=
False
def
__init__
(
self
,
queryset
,
output_field
=
None
,
**
extra
):
def
__init__
(
self
,
queryset
,
output_field
=
None
,
**
extra
):
self
.
queryset
=
queryset
self
.
queryset
=
queryset
...
...
tests/expressions/tests.py
Dosyayı görüntüle @
f021c110
...
@@ -534,6 +534,18 @@ class BasicExpressionsTests(TestCase):
...
@@ -534,6 +534,18 @@ class BasicExpressionsTests(TestCase):
outer
=
Company
.
objects
.
filter
(
pk__in
=
Subquery
(
inner
.
values
(
'pk'
)))
outer
=
Company
.
objects
.
filter
(
pk__in
=
Subquery
(
inner
.
values
(
'pk'
)))
self
.
assertFalse
(
outer
.
exists
())
self
.
assertFalse
(
outer
.
exists
())
def
test_subquery_filter_by_aggregate
(
self
):
Number
.
objects
.
create
(
integer
=
1000
,
float
=
1.2
)
Employee
.
objects
.
create
(
salary
=
1000
)
qs
=
Number
.
objects
.
annotate
(
min_valuable_count
=
Subquery
(
Employee
.
objects
.
filter
(
salary
=
OuterRef
(
'integer'
),
)
.
annotate
(
cnt
=
Count
(
'salary'
))
.
filter
(
cnt__gt
=
0
)
.
values
(
'cnt'
)[:
1
]
),
)
self
.
assertEqual
(
qs
.
get
()
.
float
,
1.2
)
def
test_explicit_output_field
(
self
):
def
test_explicit_output_field
(
self
):
class
FuncA
(
Func
):
class
FuncA
(
Func
):
output_field
=
models
.
CharField
()
output_field
=
models
.
CharField
()
...
...
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