mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed in master byb68212f539
. Forwardport of290c9d6654
from stable/1.8.x
This commit is contained in:
parent
f7b2978158
commit
7c7b855106
3 changed files with 19 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue