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
e5835a7c
Kaydet (Commit)
e5835a7c
authored
Tem 17, 2017
tarafından
Mariusz Felisiak
Kaydeden (comit)
Tim Graham
Tem 17, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allowed Func subclasses to add kwargs to __repr__().
Thanks Tim Graham for the review.
üst
adab280c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+12
-19
aggregates.py
django/db/models/aggregates.py
+6
-18
expressions.py
django/db/models/expressions.py
+6
-1
No files found.
django/db/models/aggregates.py
Dosyayı görüntüle @
e5835a7c
...
@@ -70,12 +70,8 @@ class Count(Aggregate):
...
@@ -70,12 +70,8 @@ class Count(Aggregate):
output_field
=
IntegerField
(),
**
extra
output_field
=
IntegerField
(),
**
extra
)
)
def
__repr__
(
self
):
def
_get_repr_options
(
self
):
return
"{}({}, distinct={})"
.
format
(
return
{
'distinct'
:
self
.
extra
[
'distinct'
]
!=
''
}
self
.
__class__
.
__name__
,
self
.
arg_joiner
.
join
(
str
(
arg
)
for
arg
in
self
.
source_expressions
),
'False'
if
self
.
extra
[
'distinct'
]
==
''
else
'True'
,
)
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
if
value
is
None
:
if
value
is
None
:
...
@@ -100,12 +96,8 @@ class StdDev(Aggregate):
...
@@ -100,12 +96,8 @@ class StdDev(Aggregate):
self
.
function
=
'STDDEV_SAMP'
if
sample
else
'STDDEV_POP'
self
.
function
=
'STDDEV_SAMP'
if
sample
else
'STDDEV_POP'
super
()
.
__init__
(
expression
,
output_field
=
FloatField
(),
**
extra
)
super
()
.
__init__
(
expression
,
output_field
=
FloatField
(),
**
extra
)
def
__repr__
(
self
):
def
_get_repr_options
(
self
):
return
"{}({}, sample={})"
.
format
(
return
{
'sample'
:
self
.
function
==
'STDDEV_SAMP'
}
self
.
__class__
.
__name__
,
self
.
arg_joiner
.
join
(
str
(
arg
)
for
arg
in
self
.
source_expressions
),
'False'
if
self
.
function
==
'STDDEV_POP'
else
'True'
,
)
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
if
value
is
None
:
if
value
is
None
:
...
@@ -134,12 +126,8 @@ class Variance(Aggregate):
...
@@ -134,12 +126,8 @@ class Variance(Aggregate):
self
.
function
=
'VAR_SAMP'
if
sample
else
'VAR_POP'
self
.
function
=
'VAR_SAMP'
if
sample
else
'VAR_POP'
super
()
.
__init__
(
expression
,
output_field
=
FloatField
(),
**
extra
)
super
()
.
__init__
(
expression
,
output_field
=
FloatField
(),
**
extra
)
def
__repr__
(
self
):
def
_get_repr_options
(
self
):
return
"{}({}, sample={})"
.
format
(
return
{
'sample'
:
self
.
function
==
'VAR_SAMP'
}
self
.
__class__
.
__name__
,
self
.
arg_joiner
.
join
(
str
(
arg
)
for
arg
in
self
.
source_expressions
),
'False'
if
self
.
function
==
'VAR_POP'
else
'True'
,
)
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
def
convert_value
(
self
,
value
,
expression
,
connection
,
context
):
if
value
is
None
:
if
value
is
None
:
...
...
django/db/models/expressions.py
Dosyayı görüntüle @
e5835a7c
...
@@ -531,11 +531,16 @@ class Func(Expression):
...
@@ -531,11 +531,16 @@ class Func(Expression):
def
__repr__
(
self
):
def
__repr__
(
self
):
args
=
self
.
arg_joiner
.
join
(
str
(
arg
)
for
arg
in
self
.
source_expressions
)
args
=
self
.
arg_joiner
.
join
(
str
(
arg
)
for
arg
in
self
.
source_expressions
)
extra
=
', '
.
join
(
str
(
key
)
+
'='
+
str
(
val
)
for
key
,
val
in
self
.
extra
.
item
s
())
extra
=
dict
(
self
.
extra
,
**
self
.
_get_repr_option
s
())
if
extra
:
if
extra
:
extra
=
', '
.
join
(
str
(
key
)
+
'='
+
str
(
val
)
for
key
,
val
in
extra
.
items
())
return
"{}({}, {})"
.
format
(
self
.
__class__
.
__name__
,
args
,
extra
)
return
"{}({}, {})"
.
format
(
self
.
__class__
.
__name__
,
args
,
extra
)
return
"{}({})"
.
format
(
self
.
__class__
.
__name__
,
args
)
return
"{}({})"
.
format
(
self
.
__class__
.
__name__
,
args
)
def
_get_repr_options
(
self
):
"""Return a dict of extra __init__() options to include in the repr."""
return
{}
def
get_source_expressions
(
self
):
def
get_source_expressions
(
self
):
return
self
.
source_expressions
return
self
.
source_expressions
...
...
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