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
fa352626
Kaydet (Commit)
fa352626
authored
Mar 01, 2018
tarafından
Tomáš Ehrlich
Kaydeden (comit)
Tim Graham
Mar 01, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29172 -- Fixed crash with Window expression in a subquery.
üst
ba4a9862
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
expressions.py
django/db/models/expressions.py
+4
-2
2.0.3.txt
docs/releases/2.0.3.txt
+3
-0
tests.py
tests/expressions_window/tests.py
+13
-0
No files found.
django/db/models/expressions.py
Dosyayı görüntüle @
fa352626
...
...
@@ -315,8 +315,10 @@ class BaseExpression:
def
relabeled_clone
(
self
,
change_map
):
clone
=
self
.
copy
()
clone
.
set_source_expressions
(
[
e
.
relabeled_clone
(
change_map
)
for
e
in
self
.
get_source_expressions
()])
clone
.
set_source_expressions
([
e
.
relabeled_clone
(
change_map
)
if
e
is
not
None
else
None
for
e
in
self
.
get_source_expressions
()
])
return
clone
def
copy
(
self
):
...
...
docs/releases/2.0.3.txt
Dosyayı görüntüle @
fa352626
...
...
@@ -25,3 +25,6 @@ Bugfixes
* Fixed a regression where a ``When()`` expression with a list argument crashes
(:ticket:`29166`).
* Fixed crash when using a ``Window()`` expression in a subquery
(:ticket:`29172`).
tests/expressions_window/tests.py
Dosyayı görüntüle @
fa352626
...
...
@@ -650,6 +650,19 @@ class WindowFunctionTests(TestCase):
salary
=
Window
(
expression
=
Sum
(
Value
(
10000
),
order_by
=
F
(
'pk'
)
.
asc
())),
)
def
test_window_expression_within_subquery
(
self
):
subquery_qs
=
Employee
.
objects
.
annotate
(
highest
=
Window
(
FirstValue
(
'id'
),
partition_by
=
F
(
'department'
),
order_by
=
F
(
'salary'
)
.
desc
())
)
.
values
(
'highest'
)
highest_salary
=
Employee
.
objects
.
filter
(
pk__in
=
subquery_qs
)
self
.
assertSequenceEqual
(
highest_salary
.
values
(
'department'
,
'salary'
),
[
{
'department'
:
'Accounting'
,
'salary'
:
50000
},
{
'department'
:
'Sales'
,
'salary'
:
55000
},
{
'department'
:
'Marketing'
,
'salary'
:
40000
},
{
'department'
:
'IT'
,
'salary'
:
60000
},
{
'department'
:
'Management'
,
'salary'
:
100000
}
])
def
test_invalid_start_value_range
(
self
):
msg
=
"start argument must be a negative integer, zero, or None, but got '3'."
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
...
...
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