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
e888a9b3
Kaydet (Commit)
e888a9b3
authored
Şub 19, 2013
tarafından
Florian Hahn
Kaydeden (comit)
Anssi Kääriäinen
Tem 31, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #15624 -- Made sure aggregations are present in SELECT
üst
e01b5a58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
query.py
django/db/models/query.py
+0
-1
query.py
django/db/models/sql/query.py
+3
-0
tests.py
tests/aggregation_regress/tests.py
+7
-0
No files found.
django/db/models/query.py
Dosyayı görüntüle @
e888a9b3
...
...
@@ -319,7 +319,6 @@ class QuerySet(object):
query
.
add_aggregate
(
aggregate_expr
,
self
.
model
,
alias
,
is_summary
=
True
)
aggregate_names
.
append
(
alias
)
query
.
append_aggregate_mask
(
aggregate_names
)
return
query
.
get_aggregation
(
using
=
self
.
db
)
...
...
django/db/models/sql/query.py
Dosyayı görüntüle @
e888a9b3
...
...
@@ -321,6 +321,7 @@ class Query(object):
# information but retrieves only the first row. Aggregate
# over the subquery instead.
if
self
.
group_by
is
not
None
:
from
django.db.models.sql.subqueries
import
AggregateQuery
query
=
AggregateQuery
(
self
.
model
)
...
...
@@ -996,6 +997,8 @@ class Query(object):
field_name
=
field_list
[
0
]
source
=
opts
.
get_field
(
field_name
)
col
=
field_name
# We want to have the alias in SELECT clause even if mask is set.
self
.
append_aggregate_mask
([
alias
])
# Add the aggregate to the query
aggregate
.
add_to_query
(
self
,
alias
,
col
=
col
,
source
=
source
,
is_summary
=
is_summary
)
...
...
tests/aggregation_regress/tests.py
Dosyayı görüntüle @
e888a9b3
...
...
@@ -250,6 +250,13 @@ class AggregationTests(TestCase):
'price__max'
:
Decimal
(
"82.80"
)
})
# Regression for #15624 - Missing SELECT columns when using values, annotate
# and aggregate in a single query
self
.
assertEqual
(
Book
.
objects
.
annotate
(
c
=
Count
(
'authors'
))
.
values
(
'c'
)
.
aggregate
(
Max
(
'c'
)),
{
'c__max'
:
3
}
)
def
test_field_error
(
self
):
# Bad field requests in aggregates are caught and reported
self
.
assertRaises
(
...
...
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