mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #27996 -- Added RandomUUID function and CryptoExtension to contrib.postgres.
This commit is contained in:
parent
98ee57e343
commit
fcb5dbfec0
9 changed files with 81 additions and 5 deletions
|
@ -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``
|
||||
==================
|
||||
|
||||
|
|
|
@ -67,6 +67,15 @@ run the query ``CREATE EXTENSION IF NOT EXISTS hstore;``.
|
|||
|
||||
Installs the ``citext`` extension.
|
||||
|
||||
``CryptoExtension``
|
||||
===================
|
||||
|
||||
.. class:: CryptoExtension()
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Installs the ``pgcrypto`` extension.
|
||||
|
||||
``HStoreExtension``
|
||||
===================
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue