#24866: Add CURRENT_TIMESTAMP function to db.functions
-------------------------------------+-------------------------------------
     Reporter:  funkybob             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  1
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jarshwah):

 Below is probably the way to go. We haven't done 0-arity Func expressions
 before though, so there may be some hidden traps waiting. It'd go in
 django.db.models.functions.py

 {{{
 class Now(Func):
     template = 'CURRENT_TIMESTAMP()'
     def __init__(self, output_field=DateTimeField(), **extra):
         super(Func, self).__init__(output_field=output_field, **extra)
 }}}

 This should (famous last words) be a relatively straight forward patch.
 I'd encourage someone that wants to get some basic familiarity with the
 ORM and expressions in general to have a go at implementing.

--
Ticket URL: <https://code.djangoproject.com/ticket/24866#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.cd8edc38287dfa788324ec6fe1deaa5d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to