From 8d1816db87e9e700d9bd5336ac25686fdf30c789 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 12 Feb 2015 09:54:42 -0500 Subject: [PATCH] [1.8.x] Added a test for UUIDField serialization; refs #24320. Backport of d7509c52466aeffb13ccd8a86475e74fdb0e6292 from master --- tests/serializers_regress/models.py | 4 ++++ tests/serializers_regress/tests.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/serializers_regress/models.py b/tests/serializers_regress/models.py index fd808639169..b7c4575c6d9 100644 --- a/tests/serializers_regress/models.py +++ b/tests/serializers_regress/models.py @@ -280,6 +280,10 @@ class SmallPKData(models.Model): # data = models.TimeField(primary_key=True) +class UUIDData(models.Model): + data = models.UUIDField(primary_key=True) + + class ComplexModel(models.Model): field1 = models.CharField(max_length=10) field2 = models.CharField(max_length=10) diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 5ec850cf62c..71a19f73811 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -10,6 +10,7 @@ from __future__ import unicode_literals import datetime import decimal +import uuid from unittest import skipUnless from django.core import serializers @@ -36,7 +37,7 @@ from .models import ( NullBooleanData, O2OData, PositiveIntegerData, PositiveIntegerPKData, PositiveSmallIntegerData, PositiveSmallIntegerPKData, ProxyBaseModel, ProxyProxyBaseModel, SlugData, SlugPKData, SmallData, SmallPKData, Tag, - TextData, TimeData, UniqueAnchor, + TextData, TimeData, UniqueAnchor, UUIDData, ) try: @@ -360,6 +361,7 @@ The end."""), # The end."""), # (pk_obj, 770, TimePKData, datetime.time(10, 42, 37)), # (pk_obj, 790, XMLPKData, ""), + (pk_obj, 791, UUIDData, uuid.uuid4()), (data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006, 6, 16, 10, 42, 37)), (data_obj, 810, ModifyingSaveData, 42),