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
463952d9
Kaydet (Commit)
463952d9
authored
Eyl 17, 2014
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Eyl 23, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23503 -- Fixed renaming of model with self-referential m2m field.
üst
83cd1863
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
schema.py
django/db/backends/schema.py
+6
-0
1.7.1.txt
docs/releases/1.7.1.txt
+3
-0
test_operations.py
tests/migrations/test_operations.py
+16
-0
No files found.
django/db/backends/schema.py
Dosyayı görüntüle @
463952d9
...
...
@@ -724,6 +724,12 @@ class BaseDatabaseSchemaEditor(object):
old_field
.
rel
.
through
.
_meta
.
get_field_by_name
(
old_field
.
m2m_reverse_field_name
())[
0
],
new_field
.
rel
.
through
.
_meta
.
get_field_by_name
(
new_field
.
m2m_reverse_field_name
())[
0
],
)
self
.
alter_field
(
new_field
.
rel
.
through
,
# for self-referential models we need to alter field from the other end too
old_field
.
rel
.
through
.
_meta
.
get_field_by_name
(
old_field
.
m2m_field_name
())[
0
],
new_field
.
rel
.
through
.
_meta
.
get_field_by_name
(
new_field
.
m2m_field_name
())[
0
],
)
def
_create_index_name
(
self
,
model
,
column_names
,
suffix
=
""
):
"""
...
...
docs/releases/1.7.1.txt
Dosyayı görüntüle @
463952d9
...
...
@@ -58,3 +58,6 @@ Bugfixes
* Added quoting of constraint names in the SQL generated by migrations to
prevent crash with uppercase characters in the name (:ticket:`23065`).
* Fixed renaming of models with a self-referential many-to-many field
(``ManyToManyField('self')``) (:ticket:`23503`).
tests/migrations/test_operations.py
Dosyayı görüntüle @
463952d9
...
...
@@ -472,6 +472,22 @@ class OperationTests(OperationTestBase):
self
.
assertFKExists
(
"test_rmwsrf_rider"
,
[
"friend_id"
],
(
"test_rmwsrf_rider"
,
"id"
))
self
.
assertFKNotExists
(
"test_rmwsrf_rider"
,
[
"friend_id"
],
(
"test_rmwsrf_horserider"
,
"id"
))
def
test_rename_model_with_self_referential_m2m
(
self
):
app_label
=
"test_rename_model_with_self_referential_m2m"
project_state
=
self
.
apply_operations
(
app_label
,
ProjectState
(),
operations
=
[
migrations
.
CreateModel
(
"ReflexivePony"
,
fields
=
[
(
"ponies"
,
models
.
ManyToManyField
(
"self"
)),
]),
])
project_state
=
self
.
apply_operations
(
app_label
,
project_state
,
operations
=
[
migrations
.
RenameModel
(
"ReflexivePony"
,
"ReflexivePony2"
),
])
apps
=
project_state
.
render
()
Pony
=
apps
.
get_model
(
app_label
,
"ReflexivePony2"
)
pony
=
Pony
.
objects
.
create
()
pony
.
ponies
.
add
(
pony
)
def
test_add_field
(
self
):
"""
Tests the AddField operation.
...
...
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