-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django 1.9 incompatibility #90
Comments
I've forked this project and released django-mongoengine-forms on PyPI. I've stripped out a lot of the legacy stuff and it should be compatible with Django 1.9. If you find any issues I'd be very happy to hear them. |
nice @thomwiggers ! I was implementing the 1.9 compats but I'm gonna try to use your fork. We've developed a few useful features and fixes on our side, I might to a PR on your repo :) |
Following patch fixes a missing attribute new_objects error with django 1.8.8; I wrong put this into django-mongoadmin issues :( mea maxima culpa diff --git a/mongodbforms/documents.py b/mongodbforms/documents.py |
sorry that looks awful; I'm not a git person obviously :(, but maybe an old git :) 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)``` |
Django 1.9 has been released recently. Using this version, django-mongodbforms fails to load with the following exception:
There is already a pull request to fix this issue. Please merge this code to the master branch.
The text was updated successfully, but these errors were encountered: