Ticket #24608: 24608-test.diff

File 24608-test.diff, 1.1 KB (added by Tim Graham, 10 years ago)
  • tests/model_fields/models.py

    diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
    index 620fa9e..4dc8c7a 100644
    a b class PrimaryKeyUUIDModel(models.Model):  
    373373    id = models.UUIDField(primary_key=True, default=uuid.uuid4)
    374374
    375375
     376class UUIDChild(PrimaryKeyUUIDModel):
     377    pass
     378
     379
     380class UUIDGrandchild(UUIDChild):
     381    pass
     382
     383
    376384class RelatedToUUIDModel(models.Model):
    377385    uuid_fk = models.ForeignKey('PrimaryKeyUUIDModel')
  • tests/model_fields/test_uuid.py

    diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py
    index 28e1191..0e67033 100644
    a b class TestAsPrimaryKey(TestCase):  
    124124        self.assertTrue(u2_found)
    125125        self.assertEqual(PrimaryKeyUUIDModel.objects.count(), 2)
    126126
     127    def test_uuid_grandchild(self):
     128        from .models import UUIDGrandchild
     129        a = UUIDGrandchild()
     130        a.save()
     131        a.save()  # regression for #24608
     132
    127133    def test_underlying_field(self):
    128134        pk_model = PrimaryKeyUUIDModel.objects.create()
    129135        RelatedToUUIDModel.objects.create(uuid_fk=pk_model)
Back to Top