Changes between Initial Version and Version 1 of Ticket #24485, comment 2


Ignore:
Timestamp:
Mar 15, 2015, 12:37:55 AM (10 years ago)
Author:
Josh Smeaton

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24485, comment 2

    initial v1  
    55{{{
    66Ticket.objects.annotate(
    7     expires_at=(F('active_at') + F('duration'), output_field=models.DateTimeField())
     7    expires_at=F('active_at') + F('duration', output_field=models.DateTimeField())
    88)
    99}}}
    1010
    11 Note that I've removed the Sum. We're now just adding two fields. I'm not 100% sure that this is supported on all backends, but if it's not it should be. Also note that I've wrapped both F() expressions in brackets so that I can apply the output_field to the combination of both. Can you give that a go and report back please?
     11Note that I've removed the Sum. We're now just adding two fields. I'm not 100% sure that this is supported on all backends, but if it's not it should be. Also note that I've provided a datetime output field to the duration F expression. That's so that both expressions have the same output type, so that the entire expression will have an output type of DateTimeField. We should probably have a new type whose purpose is to provide an output field for the entire expression.
     12
     13Can you give that a go and report back please?
Back to Top