diff options
| author | Roger Hu <rhu@hearsaycorp.com> | 2013-12-06 01:14:57 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-02-14 20:57:32 -0500 |
| commit | 9a446211bd13998aa6f0b6a3e6e6cdd1c69df704 (patch) | |
| tree | d1ecec0427f63830da597055bc29117e485ccf7e /tests | |
| parent | 32a880ae95fe19f0c6383571d4aab58f03044686 (diff) | |
[1.6.x] Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject.
Backport of bbc73e6a12 from master.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/foreign_object/tests.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index cd81cc68a2..592dff8854 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 @@ -362,6 +362,13 @@ 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 # to manually deal with the foreignobject relation. |
