diff options
| author | Ahmed Nassar <a.moh.nassar00@gmail.com> | 2025-03-21 17:13:36 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-04-02 09:33:13 +0200 |
| commit | 00c68f03b5dc6c14618026347ee0da4d466c88e3 (patch) | |
| tree | 4e02e8a71f5de819ace5887cb54ea11ed8467783 /tests/contenttypes_tests/models.py | |
| parent | be1b776ad8d6f9bccfbdf63f84b16fb81a13119e (diff) | |
Fixed #36267 -- Fixed contenttypes shortcut() view crash with an invalid object_id for a UUIDField pk.
Diffstat (limited to 'tests/contenttypes_tests/models.py')
| -rw-r--r-- | tests/contenttypes_tests/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/contenttypes_tests/models.py b/tests/contenttypes_tests/models.py index 5e40217c30..90a928fc2f 100644 --- a/tests/contenttypes_tests/models.py +++ b/tests/contenttypes_tests/models.py @@ -1,3 +1,4 @@ +import uuid from urllib.parse import quote from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation @@ -112,3 +113,10 @@ class ModelWithM2MToSite(models.Model): def get_absolute_url(self): return "/title/%s/" % quote(self.title) + + +class UUIDModel(models.Model): + id = models.UUIDField(primary_key=True, default=uuid.uuid4) + + def get_absolute_url(self): + return "/uuid/%s/" % self.pk |
