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
c0118ff8
Kaydet (Commit)
c0118ff8
authored
May 13, 2016
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #24201 -- Ignored order_with_respect_to private fields in migrations.
Thanks Tim for the review.
üst
18900e55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
state.py
django/db/migrations/state.py
+3
-0
test_state.py
tests/migrations/test_state.py
+14
-0
No files found.
django/db/migrations/state.py
Dosyayı görüntüle @
c0118ff8
...
...
@@ -443,6 +443,9 @@ class ModelState(object):
for
key
in
[
"unique_together"
,
"index_together"
,
"order_with_respect_to"
]:
if
key
in
options
:
del
options
[
key
]
# Private fields are ignored, so remove options that refer to them.
elif
options
.
get
(
'order_with_respect_to'
)
in
{
field
.
name
for
field
in
model
.
_meta
.
private_fields
}:
del
options
[
'order_with_respect_to'
]
def
flatten_bases
(
model
):
bases
=
[]
...
...
tests/migrations/test_state.py
Dosyayı görüntüle @
c0118ff8
...
...
@@ -9,6 +9,7 @@ from django.db.migrations.state import (
ModelState
,
ProjectState
,
get_related_models_recursive
,
)
from
django.test
import
SimpleTestCase
,
override_settings
from
django.test.utils
import
isolate_apps
from
django.utils
import
six
from
.models
import
(
...
...
@@ -911,6 +912,19 @@ class ModelStateTests(SimpleTestCase):
self
.
assertEqual
([
name
for
name
,
mgr
in
food_state
.
managers
],
[
'food_mgr'
])
self
.
assertEqual
(
food_state
.
managers
[
0
][
1
]
.
args
,
(
'a'
,
'b'
,
1
,
2
))
@isolate_apps
(
'migrations'
,
'django.contrib.contenttypes'
)
def
test_order_with_respect_to_private_field
(
self
):
class
PrivateFieldModel
(
models
.
Model
):
content_type
=
models
.
ForeignKey
(
'contenttypes.ContentType'
,
models
.
CASCADE
)
object_id
=
models
.
PositiveIntegerField
()
private
=
GenericForeignKey
()
class
Meta
:
order_with_respect_to
=
'private'
state
=
ModelState
.
from_model
(
PrivateFieldModel
)
self
.
assertNotIn
(
'order_with_respect_to'
,
state
.
options
)
class
RelatedModelsTests
(
SimpleTestCase
):
...
...
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