Ticket #12888: patch-12888.diff
File patch-12888.diff, 2.1 KB (added by , 15 years ago) |
---|
-
django/db/models/fields/related.py
227 227 value._state.db = router.db_for_write(value.__class__, instance=instance) 228 228 elif value._state.db is not None and instance._state.db is not None: 229 229 if not router.allow_relation(value, instance): 230 raise ValueError('Cannot assign "%r": instance is on database "%s", value is ison database "%s"' %230 raise ValueError('Cannot assign "%r": instance is on database "%s", value is on database "%s"' % 231 231 (value, instance._state.db, value._state.db)) 232 232 233 233 # Set the value of the related field to the value of the related object's related field … … 299 299 value._state.db = router.db_for_write(value.__class__, instance=instance) 300 300 elif value._state.db is not None and instance._state.db is not None: 301 301 if not router.allow_relation(value, instance): 302 raise ValueError('Cannot assign "%r": instance is on database "%s", value is ison database "%s"' %302 raise ValueError('Cannot assign "%r": instance is on database "%s", value is on database "%s"' % 303 303 (value, instance._state.db, value._state.db)) 304 304 305 305 # If we're setting the value of a OneToOneField to None, we need to clear … … 521 521 for obj in objs: 522 522 if isinstance(obj, self.model): 523 523 if not router.allow_relation(obj, self.instance): 524 raise ValueError('Cannot add "%r": instance is on database "%s", value is ison database "%s"' %524 raise ValueError('Cannot add "%r": instance is on database "%s", value is on database "%s"' % 525 525 (obj, self.instance._state.db, obj._state.db)) 526 526 new_ids.add(obj.pk) 527 527 elif isinstance(obj, Model):