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
a780505f
Kaydet (Commit)
a780505f
authored
Eyl 24, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #14030 -- Removed more backwards compatiblity for old-style aggregates.
Per deprecation timeline.
üst
dfa81bb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
32 deletions
+0
-32
aggregates.py
django/db/models/aggregates.py
+0
-32
No files found.
django/db/models/aggregates.py
Dosyayı görüntüle @
a780505f
...
...
@@ -24,7 +24,6 @@ class Aggregate(Func):
before_resolved
=
self
.
get_source_expressions
()[
index
]
name
=
before_resolved
.
name
if
hasattr
(
before_resolved
,
'name'
)
else
repr
(
before_resolved
)
raise
FieldError
(
"Cannot compute
%
s('
%
s'): '
%
s' is an aggregate"
%
(
c
.
name
,
name
,
name
))
c
.
_patch_aggregate
(
query
)
# backward-compatibility support
return
c
@property
...
...
@@ -41,37 +40,6 @@ class Aggregate(Func):
def
get_group_by_cols
(
self
):
return
[]
def
_patch_aggregate
(
self
,
query
):
"""
Helper method for patching 3rd party aggregates that do not yet support
the new way of subclassing. This method will be removed in Django 1.10.
add_to_query(query, alias, col, source, is_summary) will be defined on
legacy aggregates which, in turn, instantiates the SQL implementation of
the aggregate. In all the cases found, the general implementation of
add_to_query looks like:
def add_to_query(self, query, alias, col, source, is_summary):
klass = SQLImplementationAggregate
aggregate = klass(col, source=source, is_summary=is_summary, **self.extra)
query.aggregates[alias] = aggregate
By supplying a known alias, we can get the SQLAggregate out of the
aggregates dict, and use the sql_function and sql_template attributes
to patch *this* aggregate.
"""
if
not
hasattr
(
self
,
'add_to_query'
)
or
self
.
function
is
not
None
:
return
placeholder_alias
=
"_XXXXXXXX_"
self
.
add_to_query
(
query
,
placeholder_alias
,
None
,
None
,
None
)
sql_aggregate
=
query
.
aggregates
.
pop
(
placeholder_alias
)
if
'sql_function'
not
in
self
.
extra
and
hasattr
(
sql_aggregate
,
'sql_function'
):
self
.
extra
[
'function'
]
=
sql_aggregate
.
sql_function
if
hasattr
(
sql_aggregate
,
'sql_template'
):
self
.
extra
[
'template'
]
=
sql_aggregate
.
sql_template
class
Avg
(
Aggregate
):
function
=
'AVG'
...
...
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