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
bf69375c
Kaydet (Commit)
bf69375c
authored
Mar 25, 2014
tarafından
Loic Bistuer
Kaydeden (comit)
Tim Graham
Mar 25, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.7.x] Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models.
Backport of
69d4b1c3
from master
üst
ddcbde41
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
state.py
django/db/migrations/state.py
+3
-2
test_state.py
tests/migrations/test_state.py
+11
-0
No files found.
django/db/migrations/state.py
Dosyayı görüntüle @
bf69375c
...
...
@@ -58,8 +58,9 @@ class ProjectState(object):
"Takes in an Apps and returns a ProjectState matching it"
app_models
=
{}
for
model
in
apps
.
get_models
():
model_state
=
ModelState
.
from_model
(
model
)
app_models
[(
model_state
.
app_label
,
model_state
.
name
.
lower
())]
=
model_state
if
model
.
_meta
.
managed
:
model_state
=
ModelState
.
from_model
(
model
)
app_models
[(
model_state
.
app_label
,
model_state
.
name
.
lower
())]
=
model_state
return
cls
(
app_models
)
def
__eq__
(
self
,
other
):
...
...
tests/migrations/test_state.py
Dosyayı görüntüle @
bf69375c
...
...
@@ -52,11 +52,22 @@ class StateTests(TestCase):
verbose_name
=
"tome"
db_table
=
"test_tome"
class
Unmanaged
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
1000
)
class
Meta
:
app_label
=
"migrations"
apps
=
new_apps
managed
=
False
project_state
=
ProjectState
.
from_apps
(
new_apps
)
author_state
=
project_state
.
models
[
'migrations'
,
'author'
]
author_proxy_state
=
project_state
.
models
[
'migrations'
,
'authorproxy'
]
sub_author_state
=
project_state
.
models
[
'migrations'
,
'subauthor'
]
book_state
=
project_state
.
models
[
'migrations'
,
'book'
]
# unmanaged models should not appear in migrations
with
self
.
assertRaises
(
KeyError
):
project_state
.
models
[
'migrations'
,
'unmanaged'
]
self
.
assertEqual
(
author_state
.
app_label
,
"migrations"
)
self
.
assertEqual
(
author_state
.
name
,
"Author"
)
...
...
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