mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Fixed #32442 -- Used converters on returning fields from INSERT statements.
This commit is contained in:
parent
619f26d289
commit
d9de74141e
4 changed files with 47 additions and 11 deletions
|
|
@ -1,7 +1,8 @@
|
|||
from django.db import IntegrityError, transaction
|
||||
from django.test import TestCase, skipIfDBFeature
|
||||
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
|
||||
|
||||
from .models import Bar, Business, Employee, Foo
|
||||
from .fields import MyWrapper
|
||||
from .models import Bar, Business, CustomAutoFieldModel, Employee, Foo
|
||||
|
||||
|
||||
class BasicCustomPKTests(TestCase):
|
||||
|
|
@ -230,3 +231,13 @@ class CustomPKTests(TestCase):
|
|||
with self.assertRaises(IntegrityError):
|
||||
with transaction.atomic():
|
||||
Employee.objects.create(first_name="Tom", last_name="Smith")
|
||||
|
||||
def test_auto_field_subclass_create(self):
|
||||
obj = CustomAutoFieldModel.objects.create()
|
||||
self.assertIsInstance(obj.id, MyWrapper)
|
||||
|
||||
@skipUnlessDBFeature('can_return_rows_from_bulk_insert')
|
||||
def test_auto_field_subclass_bulk_create(self):
|
||||
obj = CustomAutoFieldModel()
|
||||
CustomAutoFieldModel.objects.bulk_create([obj])
|
||||
self.assertIsInstance(obj.id, MyWrapper)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue