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
333cbdcd
Kaydet (Commit)
333cbdcd
authored
Agu 05, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24951 -- Fixed AssertionError in delete queries involving a foreign/primary key.
Thanks Anssi Kääriäinen for help.
üst
1b8d7eff
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
compiler.py
django/db/models/sql/compiler.py
+1
-1
1.8.5.txt
docs/releases/1.8.5.txt
+2
-1
models.py
tests/one_to_one/models.py
+1
-1
tests.py
tests/one_to_one/tests.py
+9
-1
No files found.
django/db/models/sql/compiler.py
Dosyayı görüntüle @
333cbdcd
...
...
@@ -995,7 +995,7 @@ class SQLDeleteCompiler(SQLCompiler):
Creates the SQL for this query. Returns the SQL string and list of
parameters.
"""
assert
len
(
self
.
query
.
tables
)
==
1
,
\
assert
len
(
[
t
for
t
in
self
.
query
.
tables
if
self
.
query
.
alias_refcount
[
t
]
>
0
]
)
==
1
,
\
"Can only delete from one table at a time."
qn
=
self
.
quote_name_unless_alias
result
=
[
'DELETE FROM
%
s'
%
qn
(
self
.
query
.
tables
[
0
])]
...
...
docs/releases/1.8.5.txt
Dosyayı görüntüle @
333cbdcd
...
...
@@ -9,4 +9,5 @@ Django 1.8.5 fixes several bugs in 1.8.4.
Bugfixes
========
* ...
* Fixed ``AssertionError`` in some delete queries with a model containing a
field that is both a foreign and primary key (:ticket:`24951`).
tests/one_to_one/models.py
Dosyayı görüntüle @
333cbdcd
...
...
@@ -83,7 +83,7 @@ class MultiModel(models.Model):
class
Target
(
models
.
Model
):
pass
name
=
models
.
CharField
(
max_length
=
50
)
class
Pointer
(
models
.
Model
):
...
...
tests/one_to_one/tests.py
Dosyayı görüntüle @
333cbdcd
...
...
@@ -5,7 +5,8 @@ from django.test import TestCase
from
.models
import
(
Bar
,
Director
,
Favorites
,
HiddenPointer
,
ManualPrimaryKey
,
MultiModel
,
Place
,
RelatedModel
,
Restaurant
,
School
,
Target
,
UndergroundBar
,
Waiter
,
Place
,
Pointer
,
RelatedModel
,
Restaurant
,
School
,
Target
,
UndergroundBar
,
Waiter
,
)
...
...
@@ -256,6 +257,13 @@ class OneToOneTests(TestCase):
[]
)
def
test_o2o_primary_key_delete
(
self
):
t
=
Target
.
objects
.
create
(
name
=
'name'
)
Pointer
.
objects
.
create
(
other
=
t
)
num_deleted
,
objs
=
Pointer
.
objects
.
filter
(
other__name
=
'name'
)
.
delete
()
self
.
assertEqual
(
num_deleted
,
1
)
self
.
assertEqual
(
objs
,
{
'one_to_one.Pointer'
:
1
})
def
test_reverse_object_does_not_exist_cache
(
self
):
"""
Regression for #13839 and #17439.
...
...
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