title: Django update queryset with annotation
body: <p>I want to update all rows in queryset by using annotated value.</p>
  
  <p>I have a simple models:</p>
  
  <pre><code>class Relation(models.Model):
      rating = models.IntegerField(default=0)
  
  class SignRelation(models.Model):
      relation = models.ForeignKey(Relation, related_name='sign_relations')
      rating = models.IntegerField(default=0)
  </code></pre>
  
  <p>And I want to awoid this code:</p>
  
  <pre><code>for relation in Relation.objects.annotate(total_rating=Sum('sign_relations__rating')):
      relation.rating = relation.total_rating or 0
      relation.save()
  </code></pre>
  
  <p>And do update in <strong>one SQL-request</strong> by using something like this:</p>
  
  <pre><code>Relation.objects.update(rating=Sum('sign_relations__rating'))
  </code></pre>
  
  <p>Doesn't work:</p>
  
  <pre><code>TypeError: int() argument must be a string or a number, not 'Sum'
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Relation.objects.annotate(total_rating=Sum('sign_relations__rating')).update(rating=F('total_rating'))
  </code></pre>
  
  <p>Also doesn't work:</p>
  
  <pre><code>DatabaseError: missing FROM-clause entry for table "relations_signrelation"
  LINE 1: UPDATE "relations_relation" SET "rating" = SUM("relations_si...
  </code></pre>
  
  <p>Is it possible to use Django's ORM for this purpose? There is no info about using <em>update()</em> and <em>annotate()</em> together in docs.</p>