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
2dc9ec56
Kaydet (Commit)
2dc9ec56
authored
Agu 20, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24525 -- Fixed AssertionError in some complex queries.
Thanks Anssi Kääriäinen for providing the solution.
üst
e7b7f946
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
4 deletions
+19
-4
query.py
django/db/models/sql/query.py
+2
-1
1.8.5.txt
docs/releases/1.8.5.txt
+2
-0
models.py
tests/queries/models.py
+1
-0
tests.py
tests/queries/tests.py
+14
-3
No files found.
django/db/models/sql/query.py
Dosyayı görüntüle @
2dc9ec56
...
@@ -556,7 +556,8 @@ class Query(object):
...
@@ -556,7 +556,8 @@ class Query(object):
# distinct joins for the same connection in rhs query, then the
# distinct joins for the same connection in rhs query, then the
# combined query must have two joins, too.
# combined query must have two joins, too.
reuse
.
discard
(
new_alias
)
reuse
.
discard
(
new_alias
)
change_map
[
alias
]
=
new_alias
if
alias
!=
new_alias
:
change_map
[
alias
]
=
new_alias
if
not
rhs
.
alias_refcount
[
alias
]:
if
not
rhs
.
alias_refcount
[
alias
]:
# The alias was unused in the rhs query. Unref it so that it
# The alias was unused in the rhs query. Unref it so that it
# will be unused in the new query, too. We have to add and
# will be unused in the new query, too. We have to add and
...
...
docs/releases/1.8.5.txt
Dosyayı görüntüle @
2dc9ec56
...
@@ -14,6 +14,8 @@ Bugfixes
...
@@ -14,6 +14,8 @@ Bugfixes
* Fixed ``AssertionError`` in some delete queries with a model containing a
* Fixed ``AssertionError`` in some delete queries with a model containing a
field that is both a foreign and primary key (:ticket:`24951`).
field that is both a foreign and primary key (:ticket:`24951`).
* Fixed ``AssertionError`` in some complex queries (:ticket:`24525`).
* Fixed a migrations crash with ``GenericForeignKey`` (:ticket:`25040`).
* Fixed a migrations crash with ``GenericForeignKey`` (:ticket:`25040`).
* Made ``translation.override()`` clear the overridden language when a
* Made ``translation.override()`` clear the overridden language when a
...
...
tests/queries/models.py
Dosyayı görüntüle @
2dc9ec56
...
@@ -49,6 +49,7 @@ class Tag(models.Model):
...
@@ -49,6 +49,7 @@ class Tag(models.Model):
class
Note
(
models
.
Model
):
class
Note
(
models
.
Model
):
note
=
models
.
CharField
(
max_length
=
100
)
note
=
models
.
CharField
(
max_length
=
100
)
misc
=
models
.
CharField
(
max_length
=
10
)
misc
=
models
.
CharField
(
max_length
=
10
)
tag
=
models
.
ForeignKey
(
Tag
,
models
.
SET_NULL
,
blank
=
True
,
null
=
True
)
class
Meta
:
class
Meta
:
ordering
=
[
'note'
]
ordering
=
[
'note'
]
...
...
tests/queries/tests.py
Dosyayı görüntüle @
2dc9ec56
...
@@ -1180,7 +1180,7 @@ class Queries1Tests(BaseQuerysetTest):
...
@@ -1180,7 +1180,7 @@ class Queries1Tests(BaseQuerysetTest):
msg
=
(
msg
=
(
"Cannot resolve keyword 'unknown_field' into field. Choices are: "
"Cannot resolve keyword 'unknown_field' into field. Choices are: "
"annotation, category, category_id, children, id, item, "
"annotation, category, category_id, children, id, item, "
"managedmodel, name, parent, parent_id"
"managedmodel, name,
note,
parent, parent_id"
)
)
with
self
.
assertRaisesMessage
(
FieldError
,
msg
):
with
self
.
assertRaisesMessage
(
FieldError
,
msg
):
Tag
.
objects
.
filter
(
unknown_field__name
=
'generic'
)
Tag
.
objects
.
filter
(
unknown_field__name
=
'generic'
)
...
@@ -1326,8 +1326,8 @@ class Queries4Tests(BaseQuerysetTest):
...
@@ -1326,8 +1326,8 @@ class Queries4Tests(BaseQuerysetTest):
generic
=
NamedCategory
.
objects
.
create
(
name
=
"Generic"
)
generic
=
NamedCategory
.
objects
.
create
(
name
=
"Generic"
)
cls
.
t1
=
Tag
.
objects
.
create
(
name
=
't1'
,
category
=
generic
)
cls
.
t1
=
Tag
.
objects
.
create
(
name
=
't1'
,
category
=
generic
)
n1
=
Note
.
objects
.
create
(
note
=
'n1'
,
misc
=
'foo'
,
id
=
1
)
n1
=
Note
.
objects
.
create
(
note
=
'n1'
,
misc
=
'foo'
)
n2
=
Note
.
objects
.
create
(
note
=
'n2'
,
misc
=
'bar'
,
id
=
2
)
n2
=
Note
.
objects
.
create
(
note
=
'n2'
,
misc
=
'bar'
)
e1
=
ExtraInfo
.
objects
.
create
(
info
=
'e1'
,
note
=
n1
)
e1
=
ExtraInfo
.
objects
.
create
(
info
=
'e1'
,
note
=
n1
)
e2
=
ExtraInfo
.
objects
.
create
(
info
=
'e2'
,
note
=
n2
)
e2
=
ExtraInfo
.
objects
.
create
(
info
=
'e2'
,
note
=
n2
)
...
@@ -1342,6 +1342,17 @@ class Queries4Tests(BaseQuerysetTest):
...
@@ -1342,6 +1342,17 @@ class Queries4Tests(BaseQuerysetTest):
Item
.
objects
.
create
(
name
=
'i1'
,
created
=
datetime
.
datetime
.
now
(),
note
=
n1
,
creator
=
cls
.
a1
)
Item
.
objects
.
create
(
name
=
'i1'
,
created
=
datetime
.
datetime
.
now
(),
note
=
n1
,
creator
=
cls
.
a1
)
Item
.
objects
.
create
(
name
=
'i2'
,
created
=
datetime
.
datetime
.
now
(),
note
=
n1
,
creator
=
cls
.
a3
)
Item
.
objects
.
create
(
name
=
'i2'
,
created
=
datetime
.
datetime
.
now
(),
note
=
n1
,
creator
=
cls
.
a3
)
def
test_ticket24525
(
self
):
tag
=
Tag
.
objects
.
create
()
anth100
=
tag
.
note_set
.
create
(
note
=
'ANTH'
,
misc
=
'100'
)
math101
=
tag
.
note_set
.
create
(
note
=
'MATH'
,
misc
=
'101'
)
s1
=
tag
.
annotation_set
.
create
(
name
=
'1'
)
s2
=
tag
.
annotation_set
.
create
(
name
=
'2'
)
s1
.
notes
=
[
math101
,
anth100
]
s2
.
notes
=
[
math101
]
result
=
math101
.
annotation_set
.
all
()
&
tag
.
annotation_set
.
exclude
(
notes__in
=
[
anth100
])
self
.
assertEqual
(
list
(
result
),
[
s2
])
def
test_ticket11811
(
self
):
def
test_ticket11811
(
self
):
unsaved_category
=
NamedCategory
(
name
=
"Other"
)
unsaved_category
=
NamedCategory
(
name
=
"Other"
)
with
six
.
assertRaisesRegex
(
self
,
ValueError
,
with
six
.
assertRaisesRegex
(
self
,
ValueError
,
...
...
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