I want to update all rows in queryset by using annotated value.
I have a simple models:
class Relation(models.Model): rating = models.IntegerFiel
If you want to avoid many calls to the database, you should use transaction.atomic.
transaction.atomic
Read more on Django documentation: https://docs.djangoproject.com/en/1.9/topics/db/transactions/#controlling-transactions-explicitly