#24485: Support for annotate(end=F('start') + F('duration'),
output_field=DateTimeField)
-------------------------------------+-------------------------------------
Reporter: yoyoma | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: durationfield, | Triage Stage:
aggregation, annotation | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by jarshwah):
I partially agree, although the only reason (that I can foresee now..
later hindsight may show this to be totally wrong) to have a wrapper type
like this is purely to designate the output type.
The name `Expression` is already used, and has the signature
`Expression(left, connector, right, output_field)`:
{{{
Expression(F('active_at'), '+', F('duration'),
output_field=DurationField())
}}}
There is already a type that could be used although it's not exported in
`django.db.models`:
{{{
ExpressionNode(F('active_at')+F('duration'), output_field=DurationField())
}}}
I don't like the idea of exposing ExpressionNode purely because of the
name. It's an internal implementation detail, but it fits the signature. I
guess we could import it under any name we choose though:
{{{
# django.db.models.py
from django.db.expressions import ExpressionNode as Expr?
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24485#comment:6>
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/064.6eaaff1ecfe6d04240a56b2a58ca6e20%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.