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
60f795c0
Kaydet (Commit)
60f795c0
authored
Tem 01, 2015
tarafından
Kai Richard Koenig
Kaydeden (comit)
Tim Graham
Tem 02, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25040 -- Fixed migrations state crash with GenericForeignKey
üst
11cac1bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
state.py
django/db/migrations/state.py
+1
-1
test_state.py
tests/migrations/test_state.py
+7
-0
No files found.
django/db/migrations/state.py
Dosyayı görüntüle @
60f795c0
...
...
@@ -43,7 +43,7 @@ def get_related_models_recursive(model):
def
_related_models
(
m
):
return
[
f
.
related_model
for
f
in
m
.
_meta
.
get_fields
(
include_parents
=
True
,
include_hidden
=
True
)
if
f
.
is_relation
and
not
isinstance
(
f
.
related_model
,
six
.
string_types
)
if
f
.
is_relation
and
f
.
related_model
is
not
None
and
not
isinstance
(
f
.
related_model
,
six
.
string_types
)
]
+
[
subclass
for
subclass
in
m
.
__subclasses__
()
if
issubclass
(
subclass
,
models
.
Model
)
...
...
tests/migrations/test_state.py
Dosyayı görüntüle @
60f795c0
from
django.apps.registry
import
Apps
from
django.contrib.contenttypes.fields
import
GenericForeignKey
from
django.db
import
models
from
django.db.migrations.exceptions
import
InvalidBasesError
from
django.db.migrations.operations
import
(
...
...
@@ -1049,6 +1050,12 @@ class RelatedModelsTests(SimpleTestCase):
self
.
assertRelated
(
S
,
[
A
,
B
,
T
])
self
.
assertRelated
(
T
,
[
A
,
B
,
S
])
def
test_generic_fk
(
self
):
A
=
self
.
create_model
(
"A"
,
foreign_keys
=
[
models
.
ForeignKey
(
'B'
),
GenericForeignKey
()])
B
=
self
.
create_model
(
"B"
,
foreign_keys
=
[
models
.
ForeignKey
(
'C'
)])
self
.
assertRelated
(
A
,
[
B
])
self
.
assertRelated
(
B
,
[
A
])
def
test_abstract_base
(
self
):
A
=
self
.
create_model
(
"A"
,
abstract
=
True
)
B
=
self
.
create_model
(
"B"
,
bases
=
(
A
,))
...
...
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