Opened 9 years ago
Closed 9 years ago
#24866 closed New feature (fixed)
Add CURRENT_TIMESTAMP function to db.functions
Reported by: | Curtis Maloney | Owned by: | Adam Johnson |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
00:21 <+jarshwah> or.. Func(template='NOW()', output_field=DateTimeFIeld()) would work too
Postgres, MySQL, SQLite and MS SQL support this function, and it would be very handy.
In the past I've implemented it using an ExpressionNode, but with the new functions module, it could be simpler and more useful.
Change History (7)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.8 → master |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 9 years ago
Has patch: | set |
---|---|
Needs documentation: | unset |
Needs tests: | unset |
comment:6 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
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
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.