]> git.openstreetmap.org Git - osqa.git/commitdiff
Make sure to clean the original state on all objects recently fetched.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 Apr 2012 22:41:00 +0000 (22:41 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 Apr 2012 22:41:00 +0000 (22:41 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1258 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/base.py

index 33bf0c8dfbb4afe54496fae6958a62d1b71b46a7..47f71e0c4c6e857db7bc5e9def1d82d2f06de3b0 100644 (file)
@@ -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()