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__, etc.
(3) Renamed L (formerly LiteralExpr) to Literal.
(4) Got rid of get_placeholder calls.
(5) Literal.as_sql is using get_db_prep_lookup now.
(6) Removed logical connection types (AND, OR).
(7) Added bitwise connection types.

(1) This was the hardest part, but it works now, basically.

(2) Now you can do 1 + F('foo') and therewith the user does not have to
know anything about the Literal object.

(3) With the previous commit I renamed LiterExpr to L ollow the lead of
Q and F, but because of now it only used under the hood I named it to
Literal.

(4) UpdateQuery and DeleteQuery, were looking for a get_placeholder
method in the corresponding field. But there is no field in trunk
defining such a method. Furthermore isn't this the task of
get_db_prep_lookup anyway?

(5) get_db_prep_lookup is called when calling Literal.as_sql by now. So
it called whenever you deal with Literal objects. Furthermore this
solved a FIXME column in UpdateQuery.add_update_fields.

(6) I decided to remove the logical connetion types from
the ExpressionNode, because of F('foo') & 42 would do something
completely different as 24 & 42.

(7) I added the bitwise operators &, |, <<, >> and ~, for completeness.


I still have to write tests and documentation, but I would like to hear
from Russel or the other maintainers, what they think about the code.

Regards
Sebastian Noack

Attachment: signature.asc
Description: PGP signature

Reply via email to