From d34d39ade76e6b67299d8d88a7e5a2278a793dc3 Mon Sep 17 00:00:00 2001 From: Adam Chainz Date: Mon, 1 Jun 2015 18:00:34 +0100 Subject: Fixed #24894 -- Added contrib.postgres.functions.TransactionNow --- django/contrib/postgres/functions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 django/contrib/postgres/functions.py (limited to 'django/contrib/postgres/functions.py') 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) -- cgit v1.2.1