1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #24343 -- Ensure db converters are used for foreign keys.

Joint effort between myself, Josh, Anssi and Shai.
This commit is contained in:
Marc Tamlyn
2015-02-14 19:37:12 +00:00
parent dbacbc729a
commit 4755f8fc25
7 changed files with 44 additions and 15 deletions

View File

@@ -5,7 +5,9 @@ from django.core import exceptions, serializers
from django.db import models
from django.test import TestCase
from .models import NullableUUIDModel, PrimaryKeyUUIDModel, UUIDModel
from .models import (
NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDModel,
)
class TestSaveLoad(TestCase):
@@ -121,3 +123,9 @@ class TestAsPrimaryKey(TestCase):
self.assertTrue(u1_found)
self.assertTrue(u2_found)
self.assertEqual(PrimaryKeyUUIDModel.objects.count(), 2)
def test_underlying_field(self):
pk_model = PrimaryKeyUUIDModel.objects.create()
RelatedToUUIDModel.objects.create(uuid_fk=pk_model)
related = RelatedToUUIDModel.objects.get()
self.assertEqual(related.uuid_fk.pk, related.uuid_fk_id)