Fixed #27996 -- Added RandomUUID function and CryptoExtension to contrib.postgres.

This commit is contained in:
Paolo Melchiorre 2017-03-29 23:52:42 +02:00 committed by Tim Graham
parent 98ee57e343
commit fcb5dbfec0
9 changed files with 81 additions and 5 deletions

View file

@ -7,6 +7,26 @@ All of these functions are available from the
.. currentmodule:: django.contrib.postgres.functions
``RandomUUID``
==============
.. class:: RandomUUID()
.. versionadded:: 2.0
Returns a version 4 UUID.
The `pgcrypto extension`_ must be installed. You can use the
:class:`~django.contrib.postgres.operations.CryptoExtension` migration
operation to install it.
.. _pgcrypto extension: https://www.postgresql.org/docs/current/static/pgcrypto.html
Usage example::
>>> from django.contrib.postgres.functions import RandomUUID
>>> Article.objects.update(uuid=RandomUUID())
``TransactionNow``
==================