Fix clear_changed_fields() clearing unsaved documents bug #602

This commit is contained in:
Ross Lawley 2014-06-27 09:08:07 +01:00
parent 5be5685a09
commit cd63865d31
3 changed files with 9 additions and 5 deletions

View File

@ -196,3 +196,4 @@ that much better:
* Polyrabbit (https://github.com/polyrabbit) * Polyrabbit (https://github.com/polyrabbit)
* Sagiv Malihi (https://github.com/sagivmalihi) * Sagiv Malihi (https://github.com/sagivmalihi)
* Dmitry Konishchev (https://github.com/KonishchevDmitry) * Dmitry Konishchev (https://github.com/KonishchevDmitry)
* Martyn Smith (https://github.com/martynsmith)

View File

@ -6,6 +6,7 @@ Changelog
Changes in 0.9.X - DEV Changes in 0.9.X - DEV
====================== ======================
- Fix clear_changed_fields() clearing unsaved documents bug #602
- Removing support for Django 1.4.x, pymongo 2.5.x, pymongo 2.6.x. - Removing support for Django 1.4.x, pymongo 2.5.x, pymongo 2.6.x.
- Removing support for Python < 2.6.6 - Removing support for Python < 2.6.6
- Fixed $maxDistance location for geoJSON $near queries with MongoDB 2.6+ #664 - Fixed $maxDistance location for geoJSON $near queries with MongoDB 2.6+ #664

View File

@ -407,6 +407,8 @@ class BaseDocument(object):
else: else:
data = getattr(data, part, None) data = getattr(data, part, None)
if hasattr(data, "_changed_fields"): if hasattr(data, "_changed_fields"):
if hasattr(data, "_is_document") and data._is_document:
continue
data._changed_fields = [] data._changed_fields = []
self._changed_fields = [] self._changed_fields = []