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
a44fc008
Kaydet (Commit)
a44fc008
authored
Eyl 28, 2016
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Eyl 28, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27217 -- Fixed crash in CreateModel optimization with models that use mixins.
Thanks Simon Charette for review.
üst
9e07a9b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
models.py
django/db/migrations/operations/models.py
+4
-1
test_operations.py
tests/migrations/test_operations.py
+8
-1
No files found.
django/db/migrations/operations/models.py
Dosyayı görüntüle @
a44fc008
...
...
@@ -109,7 +109,10 @@ class CreateModel(ModelOperation):
return
True
# Check we didn't inherit from the model
models_to_check
=
[
base
for
base
in
self
.
bases
if
base
is
not
models
.
Model
]
models_to_check
=
[
base
for
base
in
self
.
bases
if
base
is
not
models
.
Model
and
isinstance
(
base
,
(
models
.
base
.
ModelBase
,
six
.
string_types
))
]
# Check we have no FKs/M2Ms with it
for
fname
,
field
in
self
.
fields
:
if
field
.
remote_field
:
...
...
tests/migrations/test_operations.py
Dosyayı görüntüle @
a44fc008
...
...
@@ -4,11 +4,12 @@ import unittest
from
django.db
import
connection
,
migrations
,
models
,
transaction
from
django.db.migrations.migration
import
Migration
from
django.db.migrations.operations
import
CreateModel
from
django.db.migrations.state
import
ProjectState
from
django.db.models.fields
import
NOT_PROVIDED
from
django.db.transaction
import
atomic
from
django.db.utils
import
IntegrityError
from
django.test
import
override_settings
,
skipUnlessDBFeature
from
django.test
import
SimpleTestCase
,
override_settings
,
skipUnlessDBFeature
from
.models
import
FoodManager
,
FoodQuerySet
,
UnicodeModel
from
.test_base
import
MigrationTestBase
...
...
@@ -2414,3 +2415,9 @@ class SwappableOperationTests(OperationTestBase):
with
connection
.
schema_editor
()
as
editor
:
operation
.
database_forwards
(
'test_rminigsw'
,
editor
,
project_state
,
new_state
)
operation
.
database_backwards
(
'test_rminigsw'
,
editor
,
new_state
,
project_state
)
class
TestCreateModel
(
SimpleTestCase
):
def
test_references_model_mixin
(
self
):
CreateModel
(
'name'
,
[],
bases
=
(
Mixin
,
models
.
Model
))
.
references_model
(
'other_model'
)
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