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
a07a49ee
Kaydet (Commit)
a07a49ee
authored
Tem 11, 2018
tarafından
Oliver Sauder
Kaydeden (comit)
Tim Graham
Tem 11, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29559 -- Fixed TransactionTestCase.reset_sequences for auto-created m2m through models.
üst
4d98b9d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
introspection.py
django/db/backends/base/introspection.py
+1
-1
models.py
tests/test_runner/models.py
+1
-0
tests.py
tests/test_runner/tests.py
+3
-0
No files found.
django/db/backends/base/introspection.py
Dosyayı görüntüle @
a07a49ee
...
@@ -127,7 +127,7 @@ class BaseDatabaseIntrospection:
...
@@ -127,7 +127,7 @@ class BaseDatabaseIntrospection:
for
f
in
model
.
_meta
.
local_many_to_many
:
for
f
in
model
.
_meta
.
local_many_to_many
:
# If this is an m2m using an intermediate table,
# If this is an m2m using an intermediate table,
# we don't need to reset the sequence.
# we don't need to reset the sequence.
if
f
.
remote_field
.
through
is
None
:
if
f
.
remote_field
.
through
.
_meta
.
auto_created
:
sequence
=
self
.
get_sequences
(
cursor
,
f
.
m2m_db_table
())
sequence
=
self
.
get_sequences
(
cursor
,
f
.
m2m_db_table
())
sequence_list
.
extend
(
sequence
or
[{
'table'
:
f
.
m2m_db_table
(),
'column'
:
None
}])
sequence_list
.
extend
(
sequence
or
[{
'table'
:
f
.
m2m_db_table
(),
'column'
:
None
}])
return
sequence_list
return
sequence_list
...
...
tests/test_runner/models.py
Dosyayı görüntüle @
a07a49ee
...
@@ -4,6 +4,7 @@ from django.db import models
...
@@ -4,6 +4,7 @@ from django.db import models
class
Person
(
models
.
Model
):
class
Person
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
20
)
first_name
=
models
.
CharField
(
max_length
=
20
)
last_name
=
models
.
CharField
(
max_length
=
20
)
last_name
=
models
.
CharField
(
max_length
=
20
)
friends
=
models
.
ManyToManyField
(
'self'
)
# A set of models that use a non-abstract inherited 'through' model.
# A set of models that use a non-abstract inherited 'through' model.
...
...
tests/test_runner/tests.py
Dosyayı görüntüle @
a07a49ee
...
@@ -342,6 +342,9 @@ class AutoIncrementResetTest(TransactionTestCase):
...
@@ -342,6 +342,9 @@ class AutoIncrementResetTest(TransactionTestCase):
# Regular model
# Regular model
p
=
Person
.
objects
.
create
(
first_name
=
'Jack'
,
last_name
=
'Smith'
)
p
=
Person
.
objects
.
create
(
first_name
=
'Jack'
,
last_name
=
'Smith'
)
self
.
assertEqual
(
p
.
pk
,
1
)
self
.
assertEqual
(
p
.
pk
,
1
)
# Auto-created many-to-many through model
p
.
friends
.
add
(
Person
.
objects
.
create
(
first_name
=
'Jacky'
,
last_name
=
'Smith'
))
self
.
assertEqual
(
p
.
friends
.
through
.
objects
.
first
()
.
pk
,
1
)
# Many-to-many through model
# Many-to-many through model
b
=
B
.
objects
.
create
()
b
=
B
.
objects
.
create
()
t
=
Through
.
objects
.
create
(
person
=
p
,
b
=
b
)
t
=
Through
.
objects
.
create
(
person
=
p
,
b
=
b
)
...
...
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