Merge pull request #978
This commit is contained in:
commit
7f442f7485
1
AUTHORS
1
AUTHORS
@ -220,3 +220,4 @@ that much better:
|
|||||||
* Michael Chase (https://github.com/rxsegrxup)
|
* Michael Chase (https://github.com/rxsegrxup)
|
||||||
* Eremeev Danil (https://github.com/elephanter)
|
* Eremeev Danil (https://github.com/elephanter)
|
||||||
* Catstyle Lee (https://github.com/Catstyle)
|
* Catstyle Lee (https://github.com/Catstyle)
|
||||||
|
* Kiryl Yermakou (https://github.com/rma4ok)
|
||||||
|
@ -15,6 +15,7 @@ Changes in 0.9.X - DEV
|
|||||||
- Fixed storage of microseconds in ComplexDateTimeField and unused separator option. #910
|
- Fixed storage of microseconds in ComplexDateTimeField and unused separator option. #910
|
||||||
- Django support was removed and will be available as a separate extension. #958
|
- Django support was removed and will be available as a separate extension. #958
|
||||||
- Don't send a "cls" option to ensureIndex (related to https://jira.mongodb.org/browse/SERVER-769)
|
- Don't send a "cls" option to ensureIndex (related to https://jira.mongodb.org/browse/SERVER-769)
|
||||||
|
- Fix for updating sorting in SortedListField. #978
|
||||||
|
|
||||||
Changes in 0.9.0
|
Changes in 0.9.0
|
||||||
================
|
================
|
||||||
|
@ -547,6 +547,7 @@ class BaseDocument(object):
|
|||||||
EmbeddedDocument = _import_class("EmbeddedDocument")
|
EmbeddedDocument = _import_class("EmbeddedDocument")
|
||||||
DynamicEmbeddedDocument = _import_class("DynamicEmbeddedDocument")
|
DynamicEmbeddedDocument = _import_class("DynamicEmbeddedDocument")
|
||||||
ReferenceField = _import_class("ReferenceField")
|
ReferenceField = _import_class("ReferenceField")
|
||||||
|
SortedListField = _import_class("SortedListField")
|
||||||
changed_fields = []
|
changed_fields = []
|
||||||
changed_fields += getattr(self, '_changed_fields', [])
|
changed_fields += getattr(self, '_changed_fields', [])
|
||||||
|
|
||||||
@ -577,6 +578,12 @@ class BaseDocument(object):
|
|||||||
if (hasattr(field, 'field') and
|
if (hasattr(field, 'field') and
|
||||||
isinstance(field.field, ReferenceField)):
|
isinstance(field.field, ReferenceField)):
|
||||||
continue
|
continue
|
||||||
|
elif (isinstance(field, SortedListField) and field._ordering):
|
||||||
|
# if ordering is affected whole list is changed
|
||||||
|
if any(map(lambda d: field._ordering in d._changed_fields, data)):
|
||||||
|
changed_fields.append(db_field_name)
|
||||||
|
continue
|
||||||
|
|
||||||
self._nestable_types_changed_fields(
|
self._nestable_types_changed_fields(
|
||||||
changed_fields, key, data, inspected)
|
changed_fields, key, data, inspected)
|
||||||
return changed_fields
|
return changed_fields
|
||||||
|
@ -916,6 +916,13 @@ class FieldTest(unittest.TestCase):
|
|||||||
self.assertEqual(post.comments[0].content, comment2.content)
|
self.assertEqual(post.comments[0].content, comment2.content)
|
||||||
self.assertEqual(post.comments[1].content, comment1.content)
|
self.assertEqual(post.comments[1].content, comment1.content)
|
||||||
|
|
||||||
|
post.comments[0].order = 2
|
||||||
|
post.save()
|
||||||
|
post.reload()
|
||||||
|
|
||||||
|
self.assertEqual(post.comments[0].content, comment1.content)
|
||||||
|
self.assertEqual(post.comments[1].content, comment2.content)
|
||||||
|
|
||||||
BlogPost.drop_collection()
|
BlogPost.drop_collection()
|
||||||
|
|
||||||
def test_reverse_list_sorting(self):
|
def test_reverse_list_sorting(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user