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
145d2317
Kaydet (Commit)
145d2317
authored
Tem 16, 2014
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23041: Bad base dependencies for proxy models
üst
7d0519c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
autodetector.py
django/db/migrations/autodetector.py
+1
-1
test_autodetector.py
tests/migrations/test_autodetector.py
+18
-1
No files found.
django/db/migrations/autodetector.py
Dosyayı görüntüle @
145d2317
...
...
@@ -560,7 +560,7 @@ class MigrationAutodetector(object):
for
base
in
model_state
.
bases
:
if
isinstance
(
base
,
six
.
string_types
)
and
"."
in
base
:
base_app_label
,
base_name
=
base
.
split
(
"."
,
1
)
dependencies
.
append
((
base_app_label
,
base_name
,
None
,
Fals
e
))
dependencies
.
append
((
base_app_label
,
base_name
,
None
,
Tru
e
))
# Generate creation operation
self
.
add_operation
(
app_label
,
...
...
tests/migrations/test_autodetector.py
Dosyayı görüntüle @
145d2317
...
...
@@ -42,6 +42,7 @@ class AutodetectorTests(TestCase):
author_proxy_options
=
ModelState
(
"testapp"
,
"AuthorProxy"
,
[],
{
"proxy"
:
True
,
"verbose_name"
:
"Super Author"
},
(
"testapp.author"
,
))
author_proxy_notproxy
=
ModelState
(
"testapp"
,
"AuthorProxy"
,
[],
{},
(
"testapp.author"
,
))
author_proxy_third
=
ModelState
(
"thirdapp"
,
"AuthorProxy"
,
[],
{
"proxy"
:
True
},
(
"testapp.author"
,
))
author_proxy_proxy
=
ModelState
(
"testapp"
,
"AAuthorProxyProxy"
,
[],
{
"proxy"
:
True
},
(
"testapp.authorproxy"
,
))
author_unmanaged
=
ModelState
(
"testapp"
,
"AuthorUnmanaged"
,
[],
{
"managed"
:
False
},
(
"testapp.author"
,
))
author_unmanaged_managed
=
ModelState
(
"testapp"
,
"AuthorUnmanaged"
,
[],
{},
(
"testapp.author"
,
))
author_with_m2m
=
ModelState
(
"testapp"
,
"Author"
,
[
...
...
@@ -1005,6 +1006,22 @@ class AutodetectorTests(TestCase):
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
0
,
name
=
"Author"
)
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
1
,
name
=
"Aardvark"
)
def
test_proxy_bases_first
(
self
):
"""
Tests that bases of proxies come first.
"""
# Make state
before
=
self
.
make_project_state
([])
after
=
self
.
make_project_state
([
self
.
author_empty
,
self
.
author_proxy
,
self
.
author_proxy_proxy
])
autodetector
=
MigrationAutodetector
(
before
,
after
)
changes
=
autodetector
.
_detect_changes
()
# Right number of migrations?
self
.
assertNumberMigrations
(
changes
,
'testapp'
,
1
)
self
.
assertOperationTypes
(
changes
,
'testapp'
,
0
,
[
"CreateModel"
,
"CreateModel"
,
"CreateModel"
])
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
0
,
name
=
"Author"
)
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
1
,
name
=
"AuthorProxy"
)
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
2
,
name
=
"AAuthorProxyProxy"
)
def
test_pk_fk_included
(
self
):
"""
Tests that a relation used as the primary key is kept as part of CreateModel.
...
...
@@ -1042,7 +1059,7 @@ class AutodetectorTests(TestCase):
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations"
})
def
test_last_dependency
(
self
):
"""
Tests that a dependency to an app with existing migrations uses __last__.
Tests that a dependency to an app with existing migrations uses __la
te
st__.
"""
# Load graph
loader
=
MigrationLoader
(
connection
)
...
...
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