summaryrefslogtreecommitdiff
path: root/tests/model_fields/models.py
diff options
context:
space:
mode:
authorMarc Tamlyn <marc.tamlyn@gmail.com>2014-07-15 10:35:29 +0100
committerMarc Tamlyn <marc.tamlyn@gmail.com>2014-09-16 10:08:09 +0100
commited7821231b7dbf34a6c8ca65be3b9bcbda4a0703 (patch)
tree98657032a61094eb7ac9c46d5db5bc12d25d1fa0 /tests/model_fields/models.py
parent0d1561d19739e83cf20150585c9e26894b428bad (diff)
Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
Diffstat (limited to 'tests/model_fields/models.py')
-rw-r--r--tests/model_fields/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index 430722cf4b..ed1cfa8e8d 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -1,5 +1,6 @@
import os
import tempfile
+import uuid
import warnings
try:
@@ -294,3 +295,15 @@ if Image:
width_field='headshot_width')
###############################################################################
+
+
+class UUIDModel(models.Model):
+ field = models.UUIDField()
+
+
+class NullableUUIDModel(models.Model):
+ field = models.UUIDField(blank=True, null=True)
+
+
+class PrimaryKeyUUIDModel(models.Model):
+ id = models.UUIDField(primary_key=True, default=uuid.uuid4)