Hi, following patch fixes an error in Django 1.8.8 where saving any change causes a missing attribute new_objects traceback.
diff --git a/mongodbforms/documents.py b/mongodbforms/documents.py
index 0a432a8..0397c2d 100644
--- a/mongodbforms/documents.py
+++ b/mongodbforms/documents.py
@@ -703,9 +703,16 @@ class BaseDocumentFormSet(BaseFormSet):
Saves model instances for every form, adding and changing instances
as necessary, and returns the list of instances.
"""
+
saved = []
self.new_objects = []
self.changed_objects = []
self.deleted_objects = []
+
for form in self.forms:
if not form.has_changed() and form not in self.initial_forms:
changed = form.has_changed()
new = form not in self.initial_forms
if not changed and new:
continue
obj = self.save_object(form)
if form.cleaned_data.get("DELETE", False):
@@ -715,6 +722,11 @@ class BaseDocumentFormSet(BaseFormSet):
if it has no delete method it is an embedded object. We
# just don't add to the list and it's gone. Cool huh?
continue
self.deleted_objects.append(obj)
elif new:
self.new_objects.append(obj)
elif changed:
self.changed_objects.append(obj)
if commit:
obj.save()
saved.append(obj)
Hi, following patch fixes an error in Django 1.8.8 where saving any change causes a missing attribute new_objects traceback.
diff --git a/mongodbforms/documents.py b/mongodbforms/documents.py index 0a432a8..0397c2d 100644 --- a/mongodbforms/documents.py +++ b/mongodbforms/documents.py @@ -703,9 +703,16 @@ class BaseDocumentFormSet(BaseFormSet): Saves model instances for every form, adding and changing instances as necessary, and returns the list of instances. """ + saved = []
if it has no delete method it is an embedded object. We