From 496800b3bf4460e697dee942696eaee5c56f87a0 Mon Sep 17 00:00:00 2001 From: Jay Wineinger Date: Thu, 9 Apr 2015 13:47:05 -0500 Subject: [1.8.x] Fixed #24611 -- Fixed update() crash with related UUID pk object. Backport of 923da0274a9a8c4ef2ac9776f71bd14628e39fc3 from master --- django/db/models/sql/compiler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 136d066ec3..f1bb10e228 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1006,7 +1006,10 @@ class SQLUpdateCompiler(SQLCompiler): raise FieldError("Aggregate functions are not allowed in this query") elif hasattr(val, 'prepare_database_save'): if field.rel: - 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 " -- cgit v1.3