Re: Annotate date intervals or ranges

2016-04-02 Thread Shai Berger
On Monday 07 March 2016 12:20:59 Josh Smeaton wrote: > FYI I'm implementing date_trunc based transforms in this > patch: https://github.com/django/django/pull/6243 > > Since the transform names "__month" "__year" etc are already taken by the > Extract based transforms I've not yet implemented a lo

Re: Annotate date intervals or ranges

2016-03-07 Thread Josh Smeaton
FYI I'm implementing date_trunc based transforms in this patch: https://github.com/django/django/pull/6243 Since the transform names "__month" "__year" etc are already taken by the Extract based transforms I've not yet implemented a lookup_name so that they can be used on the left hand side of

Re: Annotate date intervals or ranges

2016-03-03 Thread Josh Smeaton
A somewhat related ticket: https://code.djangoproject.com/ticket/25774 which attempts to make current datetime transforms/expressions public. These focus mainly on EXTRACT() type transformations, but there's certainly a place for date_trunc type transformations too. Feel free to create a ticket

Re: Annotate date intervals or ranges

2016-03-03 Thread Marc Tamlyn
Probably just because there hasn't been an immediate need, and because it working on every database the same way could be... awkward. When you have dates, you also have to think about the timezone implications as well - which timezone do you need that date in? It's also worth mentioning that if yo

Annotate date intervals or ranges

2016-03-02 Thread Sam Peka
It would be great if there was a way within the standard Queryset api to annotate ranges of dates. The use case is that it would remove the need to resort to RawSQL when grouping things by date ranges, such as the day of the month. I know the postgres extras package has a DateRangeField, but it