#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 yoyoma):
@jarshwah {{{F}}} only takes a {{{name}}} argument, so adding an
{{{output_field}}} kwarg results in a {{{TypeError}}}. Without the ability
to define which output field to use, I'm left with:
{{{
Ticket.objects.annotate(expires_at=F('active_at') + F('duration'))
}}}
Which results in:
{{{
FieldError: Expression contains mixed types. You must set output_field
}}}
I did, for the sake of completion, try:
{{{
Ticket.objects.annotate(expires_at=F('active_at') + F('duration'),
output_field=models.DateTimeField())
}}}
This resulted in:
{{{
AttributeError: 'DateTimeField' object has no attribute
'resolve_expression'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24485#comment:3>
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.bd8271bbef69513d84c6d515de3d4f2c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.