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

Fixed #24611 -- Fixed update() crash with related UUID pk object.

This commit is contained in:
Jay Wineinger
2015-04-09 13:47:05 -05:00
committed by Tim Graham
parent 872eb26f54
commit 923da0274a
4 changed files with 25 additions and 1 deletions

View File

@@ -1012,7 +1012,10 @@ class SQLUpdateCompiler(SQLCompiler):
raise FieldError("Aggregate functions are not allowed in this query")
elif hasattr(val, 'prepare_database_save'):
if field.remote_field:
val = val.prepare_database_save(field)
val = field.get_db_prep_save(
val.prepare_database_save(field),
connection=self.connection,
)
else:
raise TypeError("Database is trying to update a relational field "
"of type %s with a value of type %s. Make sure "