mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32442 -- Used converters on returning fields from INSERT statements.
This commit is contained in:
committed by
Mariusz Felisiak
parent
619f26d289
commit
d9de74141e
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user