def save(self, commit=True):
        # Don't try to save the new documents. Embedded objects don't have
        # a save method anyway.
        objs = super(EmbeddedDocumentFormSet, self).save(commit=False)
        objs = objs or []

        if commit and self.parent_document is not None:
            field = self.parent_document._fields.get(
                self.form._meta.embedded_field, None)
            if isinstance(field, EmbeddedDocumentField):
                try:
                    obj = objs[0]
                except __HOLE__:
                    obj = None
                setattr(
                    self.parent_document, self.form._meta.embedded_field, obj)
            else:
                setattr(
                    self.parent_document, self.form._meta.embedded_field, objs)
            self.parent_document.save()

        return objs
dataset/ETHPy150Open jschrewe/django-mongodbforms/mongodbforms/documents.py/EmbeddedDocumentFormSet.save