Reputation: 5102
how to perform following SQL operation using Django object:
update table set column = column+x where column>5
Upvotes: 2
Views: 1638
Reputation: 599450
You use F()
expressions for this.
Table.objects.filter(column__gt=5).update(column=F('column')+1)
Note, it will help you to learn Django if you start thinking in terms of models and fields rather than tables and columns.
Upvotes: 5