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
bbc73e6a
Kaydet (Commit)
bbc73e6a
authored
Ara 06, 2013
tarafından
Roger Hu
Kaydeden (comit)
Baptiste Mispelon
Ara 06, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject.
üst
38e24d68
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
query.py
django/db/models/query.py
+1
-1
tests.py
tests/foreign_object/tests.py
+7
-1
No files found.
django/db/models/query.py
Dosyayı görüntüle @
bbc73e6a
...
@@ -389,7 +389,7 @@ class QuerySet(object):
...
@@ -389,7 +389,7 @@ class QuerySet(object):
return
objs
return
objs
self
.
_for_write
=
True
self
.
_for_write
=
True
connection
=
connections
[
self
.
db
]
connection
=
connections
[
self
.
db
]
fields
=
self
.
model
.
_meta
.
local_fields
fields
=
self
.
model
.
_meta
.
local_
concrete_
fields
with
transaction
.
commit_on_success_unless_managed
(
using
=
self
.
db
):
with
transaction
.
commit_on_success_unless_managed
(
using
=
self
.
db
):
if
(
connection
.
features
.
can_combine_inserts_with_and_without_auto_increment_pk
if
(
connection
.
features
.
can_combine_inserts_with_and_without_auto_increment_pk
and
self
.
model
.
_meta
.
has_auto_field
):
and
self
.
model
.
_meta
.
has_auto_field
):
...
...
tests/foreign_object/tests.py
Dosyayı görüntüle @
bbc73e6a
...
@@ -4,7 +4,7 @@ from operator import attrgetter
...
@@ -4,7 +4,7 @@ from operator import attrgetter
from
.models
import
(
from
.models
import
(
Country
,
Person
,
Group
,
Membership
,
Friendship
,
Article
,
Country
,
Person
,
Group
,
Membership
,
Friendship
,
Article
,
ArticleTranslation
,
ArticleTag
,
ArticleIdea
,
NewsArticle
)
ArticleTranslation
,
ArticleTag
,
ArticleIdea
,
NewsArticle
)
from
django.test
import
TestCase
from
django.test
import
TestCase
,
skipUnlessDBFeature
from
django.utils.translation
import
activate
from
django.utils.translation
import
activate
from
django.core.exceptions
import
FieldError
from
django.core.exceptions
import
FieldError
from
django
import
forms
from
django
import
forms
...
@@ -380,6 +380,12 @@ class MultiColumnFKTests(TestCase):
...
@@ -380,6 +380,12 @@ class MultiColumnFKTests(TestCase):
'active_translation'
)[
0
]
.
active_translation
.
title
,
'active_translation'
)[
0
]
.
active_translation
.
title
,
"foo"
)
"foo"
)
@skipUnlessDBFeature
(
'has_bulk_insert'
)
def
test_batch_create_foreign_object
(
self
):
""" See: https://code.djangoproject.com/ticket/21566 """
objs
=
[
Person
(
name
=
"abcd_
%
s"
%
i
,
person_country
=
self
.
usa
)
for
i
in
range
(
0
,
5
)]
Person
.
objects
.
bulk_create
(
objs
,
10
)
class
FormsTests
(
TestCase
):
class
FormsTests
(
TestCase
):
# ForeignObjects should not have any form fields, currently the user needs
# ForeignObjects should not have any form fields, currently the user needs
...
...
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