﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24028	Related instance caching causes abstraction leaks from Field.get_db_prep_save	Jeremy Dunck	nobody	"This is a regression from the introduction of [[https://docs.djangoproject.com/en/dev/releases/1.5/#caching-of-related-model-instances|related instance caching]] in 1.5.

{{{
class Foo(models.Model):
    pass

class Bar(models.Model):
    foo = models.OneToOneField(Foo)
    value = models.DecimalField()

>>> foo = Foo.objects.create()
>>> bar = Bar.objects.create(foo=foo, value='1.0')
>>> foo.bar.value == Decimal('1.0')
}}}

The last line passes under 1.4, fails under 1.5+.

I think it would be reasonable to have a flag to Model.save which updates field attributes to the result of Field.to_python(value), which would plug this leak.

(I found this issue in production code under test, while upgrading from 1.4 to 1.5 on the way to 1.7.)"	Bug	closed	Database layer (models, ORM)	1.5	Normal	wontfix			Accepted	0	0	0	0	0	0
