1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #30044 -- Raised a FieldError on inherited field update attempts.

This commit is contained in:
Simon Charette
2019-01-15 23:39:49 -06:00
committed by Tim Graham
parent 4fc35a9c3e
commit 9e5e5a657b
3 changed files with 13 additions and 2 deletions

View File

@@ -24,8 +24,8 @@ from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import Approximate
from .models import (
UUID, UUIDPK, Company, Employee, Experiment, Number, Result, SimulationRun,
Time,
UUID, UUIDPK, Company, Employee, Experiment, Number, RemoteEmployee,
Result, SimulationRun, Time,
)
@@ -285,6 +285,11 @@ class BasicExpressionsTests(TestCase):
with self.assertRaisesMessage(FieldError, msg):
test_gmbh.save()
def test_update_inherited_field_value(self):
msg = 'Joined field references are not permitted in this query'
with self.assertRaisesMessage(FieldError, msg):
RemoteEmployee.objects.update(adjusted_salary=F('salary') * 5)
def test_object_update_unsaved_objects(self):
# F expressions cannot be used to update attributes on objects which do
# not yet exist in the database