summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhaya Agarwal <abhaya@instascribe.com>2015-05-13 02:34:56 +0530
committerTim Graham <timograham@gmail.com>2015-05-12 19:42:42 -0400
commit7c7b85510656cc814814b85bc52201bbd91821a9 (patch)
tree0ce9db26a31584736019b7dd213080b2cbe70b18
parentf7b297815819153b53dc1125d3f42869fb1b7ebc (diff)
[1.8.x] Refs #24698, #24712 -- Forwardported ForeignKey.get_db_prep_value() test and release notes.
Fixed in master by b68212f539f206679580afbfd008e7d329c9cd31. Forwardport of 290c9d665490d80b0a1b648fb022190d7dc375fc from stable/1.8.x
-rw-r--r--docs/releases/1.8.2.txt5
-rw-r--r--tests/model_fields/models.py8
-rw-r--r--tests/model_fields/test_uuid.py7
3 files changed, 19 insertions, 1 deletions
diff --git a/docs/releases/1.8.2.txt b/docs/releases/1.8.2.txt
index bf54aeefd4..457dac4034 100644
--- a/docs/releases/1.8.2.txt
+++ b/docs/releases/1.8.2.txt
@@ -20,3 +20,8 @@ Bugfixes
* Fixed incorrect GROUP BY clause generation on MySQL when the query's model
has a self-referential foreign key (:ticket:`24748`).
+
+* Implemented ``ForeignKey.get_db_prep_value()`` so that ``ForeignKey``\s
+ pointing to :class:`~django.db.models.UUIDField` and inheritance on models
+ with ``UUIDField`` primary keys work correctly (:ticket:`24698`,
+ :ticket:`24712`).
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index cca2b463a0..350e98a80b 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -373,3 +373,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()