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
48a2e027
Kaydet (Commit)
48a2e027
authored
Haz 24, 2014
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.7.x] Fixed #22708: Typo in autodetector base dependency gen
üst
e4c9ccdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
autodetector.py
django/db/migrations/autodetector.py
+1
-1
test_autodetector.py
tests/migrations/test_autodetector.py
+17
-0
No files found.
django/db/migrations/autodetector.py
Dosyayı görüntüle @
48a2e027
...
@@ -438,7 +438,7 @@ class MigrationAutodetector(object):
...
@@ -438,7 +438,7 @@ class MigrationAutodetector(object):
for
base
in
model_state
.
bases
:
for
base
in
model_state
.
bases
:
if
isinstance
(
base
,
six
.
string_types
)
and
"."
in
base
:
if
isinstance
(
base
,
six
.
string_types
)
and
"."
in
base
:
base_app_label
,
base_name
=
base
.
split
(
"."
,
1
)
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
# Generate creation operation
self
.
add_operation
(
self
.
add_operation
(
app_label
,
app_label
,
...
...
tests/migrations/test_autodetector.py
Dosyayı görüntüle @
48a2e027
...
@@ -69,6 +69,7 @@ class AutodetectorTests(TestCase):
...
@@ -69,6 +69,7 @@ class AutodetectorTests(TestCase):
custom_user
=
ModelState
(
"thirdapp"
,
"CustomUser"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"username"
,
models
.
CharField
(
max_length
=
255
))],
bases
=
(
AbstractBaseUser
,
))
custom_user
=
ModelState
(
"thirdapp"
,
"CustomUser"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"username"
,
models
.
CharField
(
max_length
=
255
))],
bases
=
(
AbstractBaseUser
,
))
custom_user_no_inherit
=
ModelState
(
"thirdapp"
,
"CustomUser"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"username"
,
models
.
CharField
(
max_length
=
255
))])
custom_user_no_inherit
=
ModelState
(
"thirdapp"
,
"CustomUser"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"username"
,
models
.
CharField
(
max_length
=
255
))])
aardvark
=
ModelState
(
"thirdapp"
,
"Aardvark"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
))])
aardvark
=
ModelState
(
"thirdapp"
,
"Aardvark"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
))])
aardvark_based_on_author
=
ModelState
(
"testapp"
,
"Aardvark"
,
[],
bases
=
(
"testapp.Author"
,
))
knight
=
ModelState
(
"eggs"
,
"Knight"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
))])
knight
=
ModelState
(
"eggs"
,
"Knight"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
))])
rabbit
=
ModelState
(
"eggs"
,
"Rabbit"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"knight"
,
models
.
ForeignKey
(
"eggs.Knight"
)),
(
"parent"
,
models
.
ForeignKey
(
"eggs.Rabbit"
))],
{
"unique_together"
:
[(
"parent"
,
"knight"
)]})
rabbit
=
ModelState
(
"eggs"
,
"Rabbit"
,
[(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"knight"
,
models
.
ForeignKey
(
"eggs.Knight"
)),
(
"parent"
,
models
.
ForeignKey
(
"eggs.Rabbit"
))],
{
"unique_together"
:
[(
"parent"
,
"knight"
)]})
...
@@ -935,3 +936,19 @@ class AutodetectorTests(TestCase):
...
@@ -935,3 +936,19 @@ class AutodetectorTests(TestCase):
self
.
assertOperationTypes
(
changes
,
'thirdapp'
,
0
,
[
"CreateModel"
,
"CreateModel"
])
self
.
assertOperationTypes
(
changes
,
'thirdapp'
,
0
,
[
"CreateModel"
,
"CreateModel"
])
self
.
assertOperationAttributes
(
changes
,
'thirdapp'
,
0
,
0
,
name
=
"CustomUser"
)
self
.
assertOperationAttributes
(
changes
,
'thirdapp'
,
0
,
0
,
name
=
"CustomUser"
)
self
.
assertOperationAttributes
(
changes
,
'thirdapp'
,
0
,
1
,
name
=
"Aardvark"
)
self
.
assertOperationAttributes
(
changes
,
'thirdapp'
,
0
,
1
,
name
=
"Aardvark"
)
@override_settings
(
AUTH_USER_MODEL
=
"thirdapp.CustomUser"
)
def
test_bases_first
(
self
):
"""
Tests that bases of other models come first.
"""
# Make state
before
=
self
.
make_project_state
([])
after
=
self
.
make_project_state
([
self
.
aardvark_based_on_author
,
self
.
author_name
])
autodetector
=
MigrationAutodetector
(
before
,
after
)
changes
=
autodetector
.
_detect_changes
()
# Right number of migrations?
self
.
assertNumberMigrations
(
changes
,
'testapp'
,
1
)
self
.
assertOperationTypes
(
changes
,
'testapp'
,
0
,
[
"CreateModel"
,
"CreateModel"
])
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
0
,
name
=
"Author"
)
self
.
assertOperationAttributes
(
changes
,
'testapp'
,
0
,
1
,
name
=
"Aardvark"
)
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