summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/functions.py
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2015-06-01 18:00:34 +0100
committerTim Graham <timograham@gmail.com>2015-06-15 14:03:17 -0400
commitd34d39ade76e6b67299d8d88a7e5a2278a793dc3 (patch)
tree60b65b404ce1e901eecb65fc7de3f99817d080ad /django/contrib/postgres/functions.py
parent3872a33132a4bb6aa22b237927597bbfdf6f21d7 (diff)
downloaddjango-d34d39ade76e6b67299d8d88a7e5a2278a793dc3.tar.gz
Fixed #24894 -- Added contrib.postgres.functions.TransactionNow
Diffstat (limited to 'django/contrib/postgres/functions.py')
-rw-r--r--django/contrib/postgres/functions.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/django/contrib/postgres/functions.py b/django/contrib/postgres/functions.py
new file mode 100644
index 0000000000..3184c492fc
--- /dev/null
+++ b/django/contrib/postgres/functions.py
@@ -0,0 +1,11 @@
+from django.db.models import DateTimeField
+from django.db.models.functions import Func
+
+
+class TransactionNow(Func):
+ template = 'CURRENT_TIMESTAMP'
+
+ def __init__(self, output_field=None, **extra):
+ if output_field is None:
+ output_field = DateTimeField()
+ super(TransactionNow, self).__init__(output_field=output_field, **extra)