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
fb3d85bd
Kaydet (Commit)
fb3d85bd
authored
Mar 01, 2013
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #10399 -- Tested that o2o field updates are not constrained by an inner query.
üst
952ba523
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
tests.py
tests/model_inheritance/tests.py
+25
-1
No files found.
tests/model_inheritance/tests.py
Dosyayı görüntüle @
fb3d85bd
from
__future__
import
absolute_import
from
__future__
import
absolute_import
,
unicode_literals
from
operator
import
attrgetter
from
django.core.exceptions
import
FieldError
from
django.db
import
connection
from
django.test
import
TestCase
from
django.test.testcases
import
CaptureQueriesContext
from
django.utils
import
six
from
.models
import
(
Chef
,
CommonInfo
,
ItalianRestaurant
,
ParkingLot
,
Place
,
...
...
@@ -294,3 +296,25 @@ class ModelInheritanceTests(TestCase):
)
with
self
.
assertNumQueries
(
6
):
ir
.
save
()
def
test_update_parent_filtering
(
self
):
"""
Test that updating a field of a model subclass doesn't issue an UPDATE
query constrained by an inner query.
Refs #10399
"""
supplier
=
Supplier
.
objects
.
create
(
name
=
'Central market'
,
address
=
'610 some street'
)
# Capture the expected query in a database agnostic way
with
CaptureQueriesContext
(
connection
)
as
captured_queries
:
Place
.
objects
.
filter
(
pk
=
supplier
.
pk
)
.
update
(
name
=
supplier
.
name
)
expected_sql
=
captured_queries
[
0
][
'sql'
]
# Capture the queries executed when a subclassed model instance is saved.
with
CaptureQueriesContext
(
connection
)
as
captured_queries
:
supplier
.
save
(
update_fields
=
(
'name'
,))
for
query
in
captured_queries
:
sql
=
query
[
'sql'
]
if
'UPDATE'
in
sql
:
self
.
assertEqual
(
expected_sql
,
sql
)
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