diff options
| author | Roger Hu <rhu@hearsaycorp.com> | 2013-12-06 01:14:57 +0000 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2013-12-06 20:20:16 +0100 |
| commit | bbc73e6a12227f5ed52fd38bc37f56f434a0a72c (patch) | |
| tree | 8ec28a2e4da821c4cd9997cbb0cb1854506ef351 /tests | |
| parent | 38e24d680d28b92997def9ab46a961d09bb81dce (diff) | |
Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/foreign_object/tests.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index 66f57b6f3c..f361c5c8d5 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -4,7 +4,7 @@ from operator import attrgetter from .models import ( Country, Person, Group, Membership, Friendship, Article, ArticleTranslation, ArticleTag, ArticleIdea, NewsArticle) -from django.test import TestCase +from django.test import TestCase, skipUnlessDBFeature from django.utils.translation import activate from django.core.exceptions import FieldError from django import forms @@ -380,6 +380,12 @@ class MultiColumnFKTests(TestCase): 'active_translation')[0].active_translation.title, "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): # ForeignObjects should not have any form fields, currently the user needs |
