From 3d331ce2c042eb92ae71c3875e30ddd76e8db7e3 Mon Sep 17 00:00:00 2001 From: hernani Date: Thu, 26 Apr 2012 22:41:00 +0000 Subject: [PATCH 1/1] Make sure to clean the original state on all objects recently fetched. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1258 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/models/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/forum/models/base.py b/forum/models/base.py index 33bf0c8..47f71e0 100644 --- a/forum/models/base.py +++ b/forum/models/base.py @@ -83,7 +83,8 @@ class CachedQuerySet(models.query.QuerySet): obj.cache() else: obj = self.obj_from_datadict(obj) - obj.reset_original_state() + + obj.reset_original_state() return obj @@ -171,9 +172,10 @@ class CachedQuerySet(models.query.QuerySet): if to_return: for row in to_return: if hasattr(row, 'leaf'): - yield row.leaf - else: - yield row + row = row.leaf + + row.reset_original_state() + yield row def _get_query_hash(self): return md5(unicode(self.query).encode("utf-8")).hexdigest() -- 2.39.5