summaryrefslogtreecommitdiff
path: root/docs
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 /docs
parent0d1561d19739e83cf20150585c9e26894b428bad (diff)
Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/databases.txt3
-rw-r--r--docs/ref/forms/fields.txt14
-rw-r--r--docs/ref/models/fields.txt25
-rw-r--r--docs/releases/1.8.txt10
4 files changed, 51 insertions, 1 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index ca909fcd04..7d1578bc59 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -92,7 +92,8 @@ below for information on how to set up your database correctly.
PostgreSQL notes
================
-Django supports PostgreSQL 9.0 and higher.
+Django supports PostgreSQL 9.0 and higher. It requires the use of Psycopg2
+2.0.9 or higher.
PostgreSQL connection settings
-------------------------------
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index bd7cb93389..d7fcef2e75 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -888,6 +888,20 @@ For each field, we describe the default widget used if you don't specify
These are the same as ``CharField.max_length`` and ``CharField.min_length``.
+``UUIDField``
+-------------
+
+.. versionadded:: 1.8
+
+.. class:: UUIDField(**kwargs)
+
+ * Default widget: :class:`TextInput`
+ * Empty value: ``''`` (an empty string)
+ * Normalizes to: A :class:`~python:uuid.UUID` object.
+ * Error message keys: ``required``, ``invalid``
+
+ This field will accept any string format accepted as the ``hex`` argument
+ to the :class:`~python:uuid.UUID` constructor.
Slightly complex built-in ``Field`` classes
-------------------------------------------
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index e7717e9d90..fe35f979ca 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1012,6 +1012,31 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional
:attr:`~CharField.max_length` argument. If you don't specify
:attr:`~CharField.max_length`, a default of 200 is used.
+UUIDField
+---------
+
+.. versionadded:: 1.8
+
+.. class:: UUIDField([**options])
+
+A field for storing universally unique identifiers. Uses Python's
+:class:`~python:uuid.UUID` class. When used on PostgreSQL, this stores in a
+``uuid`` datatype, otherwise in a ``char(32)``.
+
+Universally unique identifiers are a good alternative to :class:`AutoField` for
+:attr:`~Field.primary_key`. The database will not generate the UUID for you, so
+it is recommended to use :attr:`~Field.default`::
+
+ import uuid
+ from django.db import models
+
+ class MyUUIDModel(models.Model):
+ id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
+ # other fields
+
+Note that a callable (with the parentheses omitted) is passed to ``default``,
+not an instance of ``UUID``.
+
Relationship fields
===================
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 51febddd9a..a8e9ce8015 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -35,6 +35,14 @@ site.
.. _django-secure: https://pypi.python.org/pypi/django-secure
+New data types
+~~~~~~~~~~~~~~
+
+* Django now has a :class:`~django.db.models.UUIDField` for storing
+ universally unique identifiers. There is a corresponding :class:`form field
+ <django.forms.UUIDField>`. It is stored as the native ``uuid`` data type on
+ PostgreSQL and as a fixed length character field on other backends.
+
Minor features
~~~~~~~~~~~~~~
@@ -474,6 +482,8 @@ officially supports.
This also includes dropping support for PostGIS 1.3 and 1.4 as these versions
are not supported on versions of PostgreSQL later than 8.4.
+Django also now requires the use of Psycopg2 version 2.0.9 or higher.
+
Support for MySQL versions older than 5.5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~