On 5/21/07, ZebZiggle <[EMAIL PROTECTED]> wrote:
>
> UPDATE Content SET voteTotal = voteTotal + 1 WHERE id = ...
>
> Anyone have any thoughts on the problem? What am I missing?
I've thought about this before; IMHO, the right solution is to provide
an easy syntax for a Django query (or in this case, an update) to
reference itself.
My original thought, provided as part of an aggregate function
proposal, was to provide an F object, something like a Q object, that
can be used to wrap references to column values:
# Get all books whose price whose price is greater than the average price
>>> expensive_books = Books.objects.filter(avg_price__lt=F('price'))
The idea here is to provide an object representation for the field
reference that can be deferred until the SQL is rolled out.
I haven't thought about the syntax for your situation specifically,
but I don't see why it shouldn't be able to hit your use case, too.
However, any serious attempt at implementing this should probably wait
until the query.py refactor.
Yours,
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---