summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/models.py8
-rw-r--r--tests/model_fields/test_uuid.py7
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index 620fa9ec5d..2141610b0e 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -375,3 +375,11 @@ class PrimaryKeyUUIDModel(models.Model):
class RelatedToUUIDModel(models.Model):
uuid_fk = models.ForeignKey('PrimaryKeyUUIDModel')
+
+
+class UUIDChild(PrimaryKeyUUIDModel):
+ pass
+
+
+class UUIDGrandchild(UUIDChild):
+ pass
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py
index 7ce98a0852..21c2869edf 100644
--- a/tests/model_fields/test_uuid.py
+++ b/tests/model_fields/test_uuid.py
@@ -6,7 +6,8 @@ from django.db import models
from django.test import TestCase
from .models import (
- NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDModel,
+ NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDGrandchild,
+ UUIDModel,
)
@@ -146,3 +147,7 @@ class TestAsPrimaryKey(TestCase):
RelatedToUUIDModel.objects.update(uuid_fk=u2.pk)
r.refresh_from_db()
self.assertEqual(r.uuid_fk, u2)
+
+ def test_two_level_foreign_keys(self):
+ # exercises ForeignKey.get_db_prep_value()
+ UUIDGrandchild().save()