summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-02-21 10:52:51 +0100
committerGitHub <noreply@github.com>2019-02-21 10:52:51 +0100
commit9ff18c08c32cf54d3c3a7a9e459d44711adba30f (patch)
treed244a2f0133ddeabbc879b3dc65b31a4b0603d03 /docs
parent21ff23bfeb4014bceaa3df27677fb68409c0634d (diff)
Refs #28643 -- Added MD5 database function.
Thanks Tim Graham, Nick Pope and Simon Charette for reviews.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/database-functions.txt20
-rw-r--r--docs/releases/3.0.txt2
2 files changed, 21 insertions, 1 deletions
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt
index c7f7b5d981..c6203f92c4 100644
--- a/docs/ref/models/database-functions.txt
+++ b/docs/ref/models/database-functions.txt
@@ -1303,6 +1303,26 @@ Usage example::
Similar to :class:`~django.db.models.functions.Trim`, but removes only leading
spaces.
+``MD5``
+-------
+
+.. class:: MD5(expression, **extra)
+
+.. versionadded:: 3.0
+
+Accepts a single text field or expression and returns the MD5 hash of the
+string.
+
+It can also be registered as a transform as described in :class:`Length`.
+
+Usage example::
+
+ >>> from django.db.models.functions import MD5
+ >>> Author.objects.create(name='Margaret Smith')
+ >>> author = Author.objects.annotate(name_md5=MD5('name')).get()
+ >>> print(author.name_md5)
+ 749fb689816b2db85f5b169c2055b247
+
``Ord``
-------
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index 77bace661b..76777a86ef 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -162,7 +162,7 @@ Migrations
Models
~~~~~~
-* ...
+* Added the :class:`~django.db.models.functions.MD5` database function.
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~