On 30 jan, 13:46, Russell Keith-Magee <freakboy3...@gmail.com> wrote:
> If you are interested in implementing this, I'm happy to give you
> pointers. The first pointer I can suggest is that you will be looking
> at the SQLEvaluator class contained in
> django/db/models/sql/expressions.py. This class traverses the
> expression tree, turning it into raw SQL. The actual expression tree
> is a series of tree.Node objects defined in
> django/db/models/expressions.py.
>
> Also - anything you do here shouldn't be date-specific. Other data
> types - such as strings and GIS types - will require similar
> capabilities. Try to keep that in mind when you are looking to
> potential solutions for the date problem.
>
> > It seems though that the different backends will certainly need
> > different handlings:
>
> Indeed. The Postgres option should be fairly easy to implement - you
> just need to replace leaf nodes on the expression tree that are
> timedeltas with matching "interval X" statements. SQLite style
> expressions will be a little harder.
>
> Yours,
> Russ Magee %-)

I made a first attempt, see ticket #10154.

Idea is to use a specific node (and leaf) for combinations of an
expression with a timedelta.
I put the backend specifics into the relevant Operations classes (for
now only base (= sqlite implementation) and postgres).
sqlite and postgres pass the test.
The dispatching based on 'other' being a timedelta needs refining
though, since this is obviously not generic enough.

Koen


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to