Re: QuerySet.update improvement.

2008-05-23 Thread Sebastian Noack
On Fri, 23 May 2008 17:20:43 +0800 "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > I'm currently sitting in an airport, so I won't have a chance to have > a good look until tomorrow at the earliest. However, here's some > immediate feedback. Most of them are in the category of "this probably > w

Re: QuerySet.update improvement.

2008-05-23 Thread Sebastian Noack
> I'm testing on SQLite, and I don't get that failure when running on > vanilla trunk. I am sorry. You was right, but I have fixed it. > > > I just updated to your latest patch and there appears to be 2 test > > > failures:http://dpaste.com/52137/, the first one appears to be > > > caused by the

Re: QuerySet.update improvement.

2008-05-22 Thread [EMAIL PROTECTED]
I'm testing on SQLite, and I don't get that failure when running on vanilla trunk. On May 22, 6:57 pm, Sebastian Noack <[EMAIL PROTECTED]> wrote: > On Thu, 22 May 2008 14:20:26 -0700 (PDT) > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > I just updated to your latest patch and there appears

Re: QuerySet.update improvement.

2008-05-22 Thread Sebastian Noack
On Thu, 22 May 2008 14:20:26 -0700 (PDT) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I just updated to your latest patch and there appears to be 2 test > failures: http://dpaste.com/52137/ , the first one appears to be > caused by the fact that different database engines do the rounding > dif

Re: QuerySet.update improvement.

2008-05-22 Thread [EMAIL PROTECTED]
I just updated to your latest patch and there appears to be 2 test failures: http://dpaste.com/52137/ , the first one appears to be caused by the fact that different database engines do the rounding differently, my suggestion would be to change to something that divides evenly for the integer valu

Re: QuerySet.update improvement.

2008-05-22 Thread Sebastian Noack
On Wed, 21 May 2008 21:12:05 +0800 "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > What do I think? The code doesn't look fundamentally bad, but I'm not > going to take a serious look until there are some test cases. > > Consider this from my point of view. I need to validate that your code > w

Re: QuerySet.update improvement.

2008-05-21 Thread Russell Keith-Magee
On Sat, May 17, 2008 at 2:27 AM, Sebastian Noack <[EMAIL PROTECTED]> wrote: > I have released a new patch. See > http://code.djangoproject.com/attachment/ticket/7210/0001-Added-expression-support-for-QuerySet.update.3.patch. > > I still have to write tests and documentation, but I would like to he

Re: QuerySet.update improvement.

2008-05-16 Thread Sebastian Noack
I have released a new patch. See http://code.djangoproject.com/attachment/ticket/7210/0001-Added-expression-support-for-QuerySet.update.3.patch. What I have done since the last version of this patch: (1) Added F object support to filter and exclude. (2) Implemented __radd__, __rsub__, __rmul__,

Re: QuerySet.update improvement.

2008-05-10 Thread [EMAIL PROTECTED]
Tonight I will spend some time and write up a few test cases. On May 10, 10:26 am, Sebastian Noack <[EMAIL PROTECTED]> wrote: > I already implemented it as discussed with Russell. See the ticket. But > thanks for the tip with the __radd__. I didn't knew __radd__, but I > will still implement it.

Re: QuerySet.update improvement.

2008-05-10 Thread Sebastian Noack
I already implemented it as discussed with Russell. See the ticket. But thanks for the tip with the __radd__. I didn't knew __radd__, but I will still implement it. Btw, I still have to implement the Expression stuff into Query.add_filter to support filter() and exclude(), as proposed by Russel an

Re: QuerySet.update improvement.

2008-05-10 Thread [EMAIL PROTECTED]
Doh, Sean got there before me, __radd__ (and the other operations) handle the reverse situation: http://dpaste.com/49224/ - example. Looks like very cool stuff. I would recommend writing tests first, based on what should happen(not necessarily what does), and then continue with the code however.

Re: QuerySet.update improvement.

2008-05-10 Thread Sean Legassick
On 10 May 2008, at 14:47, Sebastian Noack wrote: > You can still do model.objects.update(foo=42) with my patch, because > of 42 is casted to a LiteralExpr under the hood. I could even make it > possible to do model.objects.update(foo=CurrentExpr() + 42). But there > is no way to enable model.obje

Re: QuerySet.update improvement.

2008-05-10 Thread Russell Keith-Magee
On Sat, May 10, 2008 at 9:47 PM, Sebastian Noack <[EMAIL PROTECTED]> wrote: > On Sat, 10 May 2008 20:36:14 +0800 > "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: >> * I don't see why LiteralExpr is required. Surely a literal should >> continue to work as is; if a literal is involved in an expres

Re: QuerySet.update improvement.

2008-05-10 Thread Sebastian Noack
On Sat, 10 May 2008 20:36:14 +0800 "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > The basic idea that you are proposing has been made before - for > example, several of the discussions about adding aggregations to the > ORM have included a capability similar to the one you propose. > However, t

Re: QuerySet.update improvement.

2008-05-10 Thread Russell Keith-Magee
On Sat, May 10, 2008 at 5:48 PM, Sebastian Noack <[EMAIL PROTECTED]> wrote: > Hi, > > I think QuerySet.update works to inflexible. In SQL you can define > expressions containing the current value or the value of an other > column in the update clause, for Example to incrementing a value in the > r

QuerySet.update improvement.

2008-05-10 Thread Sebastian Noack
Hi, I think QuerySet.update works to inflexible. In SQL you can define expressions containing the current value or the value of an other column in the update clause, for Example to incrementing a value in the result set. This is not possible by the ORM at the moment. I developed a possible soluti