mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Fixed #29619 -- Added field names to some FieldErrors.
This commit is contained in:
parent
5013d38380
commit
741ce81a42
4 changed files with 38 additions and 9 deletions
|
|
@ -165,7 +165,11 @@ class AdvancedTests(TestCase):
|
|||
self.assertEqual(qs.update(another_value=F('alias')), 3)
|
||||
# Update where aggregation annotation is used in update parameters
|
||||
qs = DataPoint.objects.annotate(max=Max('value'))
|
||||
with self.assertRaisesMessage(FieldError, 'Aggregate functions are not allowed in this query'):
|
||||
msg = (
|
||||
'Aggregate functions are not allowed in this query '
|
||||
'(another_value=Max(Col(update_datapoint, update.DataPoint.value))).'
|
||||
)
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
qs.update(another_value=F('max'))
|
||||
|
||||
def test_update_annotated_multi_table_queryset(self):
|
||||
|
|
@ -185,5 +189,9 @@ class AdvancedTests(TestCase):
|
|||
# self.assertEqual(updated, 1)
|
||||
# Update where aggregation annotation is used in update parameters
|
||||
qs = RelatedPoint.objects.annotate(max=Max('data__value'))
|
||||
with self.assertRaisesMessage(FieldError, 'Aggregate functions are not allowed in this query'):
|
||||
msg = (
|
||||
'Aggregate functions are not allowed in this query '
|
||||
'(name=Max(Col(update_datapoint, update.DataPoint.value))).'
|
||||
)
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
qs.update(name=F('max'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue