'Update of a queryset that\'s been annotated and involves multiple tables.'

def test_update_annotated_multi_table_queryset(self):

    qs = DataPoint.objects.annotate(related_count=Count('relatedpoint'))
    self.assertEqual(qs.update(value='Foo'), 3)
    qs = DataPoint.objects.annotate(related_count=Count('relatedpoint'))
    self.assertEqual(qs.filter(related_count=1).update(value='Foo'), 1)
    qs = RelatedPoint.objects.annotate(max=Max('data__value'))
    with self.assertRaisesMessage(FieldError, 'Aggregate    functions    are    not    allowed    in    this    query'):
        qs.update(name=F('max'))
