SELECT * FROM table WHERE height > width;
or similar UPDATE queries. This has a syntax similar to that of Q objects, using a new F object. So the above query would look like:
Model.objects.filter(height__gt=F('width'))
or an update query could look like:
Employee.objects.update(salary=F('salary')*1.1)
these objects support the full range of arithmetic operations. These are slated to be a part of Django 1.1.
Are these changes in the head trunk to be able to play with them right now ?
ReplyDelete