mirror of
https://github.com/django/django.git
synced 2025-11-23 12:26:57 +00:00
Fixed #36122 -- Raised FieldError when updating with composite reference value.
Thanks Jacob Walls for the report and test.
This commit is contained in:
parent
0ba35a4948
commit
efec74b908
2 changed files with 14 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from django.core.exceptions import FieldError
|
||||
from django.db import connection
|
||||
from django.db.models import F
|
||||
from django.test import TestCase
|
||||
|
||||
from .models import Comment, Tenant, TimeStamped, Token, User
|
||||
|
|
@ -182,3 +183,11 @@ class CompositePKUpdateTests(TestCase):
|
|||
msg = "Composite primary key fields must be updated individually."
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
qs.update(pk=(1, 10))
|
||||
|
||||
def test_update_value_not_composite(self):
|
||||
msg = (
|
||||
"Composite primary keys expressions are not allowed in this "
|
||||
"query (text=F('pk'))."
|
||||
)
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
Comment.objects.update(text=F("pk"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue