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
64240263
Kaydet (Commit)
64240263
authored
Kas 13, 2015
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #25745 -- Avoided multiple registration of the same model in schema tests.
üst
2eefbca1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
tests.py
tests/schema/tests.py
+12
-14
No files found.
tests/schema/tests.py
Dosyayı görüntüle @
64240263
...
...
@@ -64,6 +64,10 @@ class SchemaTests(TransactionTestCase):
model
.
_meta
.
_expire_cache
()
if
'schema'
in
new_apps
.
all_models
:
for
model
in
self
.
local_models
:
for
many_to_many
in
model
.
_meta
.
many_to_many
:
through
=
many_to_many
.
remote_field
.
through
if
through
and
through
.
_meta
.
auto_created
:
del
new_apps
.
all_models
[
'schema'
][
through
.
_meta
.
model_name
]
del
new_apps
.
all_models
[
'schema'
][
model
.
_meta
.
model_name
]
def
delete_tables
(
self
):
...
...
@@ -1031,13 +1035,12 @@ class SchemaTests(TransactionTestCase):
# Ensure there's no m2m table there
self
.
assertRaises
(
DatabaseError
,
self
.
column_classes
,
new_field
.
remote_field
.
through
)
# Need to tear down using a model without the added M2M field that's
# been removed.
class
LocalAuthorWithM2M
(
Model
):
class
Meta
:
app_label
=
'schema'
apps
=
new_apps
self
.
local_models
=
[
LocalAuthorWithM2M
]
# Make sure the model state is coherent with the table one now that
# we've removed the tags field.
opts
=
LocalAuthorWithM2M
.
_meta
opts
.
local_many_to_many
.
remove
(
new_field
)
del
new_apps
.
all_models
[
'schema'
][
new_field
.
remote_field
.
through
.
_meta
.
model_name
]
opts
.
_expire_cache
()
def
test_m2m
(
self
):
self
.
_test_m2m
(
ManyToManyField
)
...
...
@@ -1139,13 +1142,8 @@ class SchemaTests(TransactionTestCase):
)
# This model looks like the new model and is used for teardown.
class
LocalBookWithM2M
(
Model
):
uniques
=
M2MFieldClass
(
UniqueTest
)
class
Meta
:
app_label
=
'schema'
apps
=
new_apps
self
.
local_models
=
[
LocalBookWithM2M
]
opts
=
LocalBookWithM2M
.
_meta
opts
.
local_many_to_many
.
remove
(
old_field
)
# Ensure the new M2M exists and points to UniqueTest
constraints
=
self
.
get_constraints
(
new_field
.
remote_field
.
through
.
_meta
.
db_table
)
if
connection
.
features
.
supports_foreign_keys
:
...
...
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