GithubHelp home page GithubHelp logo

Comments (4)

thomwiggers avatar thomwiggers commented on August 16, 2024

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.

from django-mongodbforms.

m-vdb avatar m-vdb commented on August 16, 2024

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 :)

from django-mongodbforms.

replabrobin avatar replabrobin commented on August 16, 2024

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
index 0a432a8..0397c2d 100644
--- a/mongodbforms/documents.py
+++ b/mongodbforms/documents.py
....... see below for structure version :(
saved.append(obj)

from django-mongodbforms.

replabrobin avatar replabrobin commented on August 16, 2024

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)```

from django-mongodbforms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.