# Path: dockit/forms/forms.py
# class DocumentForm(BaseDocumentForm):
#     """ The document form object """
#     __metaclass__ = DocumentFormMetaClass
# 
# def documentform_factory(document, form=DocumentForm, fields=None, exclude=None,
#                              formfield_callback=None, schema=None, dotpath=None):
#     meta = UserMeta(document=document,
#                     fields=fields,
#                     exclude=exclude,
#                     formfield_callback=formfield_callback,
#                     schema=schema,
#                     dotpath=dotpath,)
#     class FactoryForm(form):
#         Meta = meta
#     
#     return FactoryForm


from django.forms.formsets import BaseFormSet, formset_factory
from django.utils.translation import ugettext_lazy as _, ugettext
from dockit.forms.forms import DocumentForm, documentform_factory
                self.deleted_objects.append(obj)
                #obj.delete()
                continue
            if form.has_changed():
                self.changed_objects.append((obj, form.changed_data))
            saved_instances.append(self.save_existing(form, obj, commit=commit))
            if not commit:
                self.saved_forms.append(form)
        return saved_instances

    def save_new_objects(self, commit=True):
        self.new_objects = []
        for form in self.extra_forms:
            if not form.has_changed():
                continue
            # If someone has marked an add form for deletion, don't save the
            # object.
            if self.can_delete and self._should_delete_form(form):
                continue
            self.new_objects.append(self.save_new(form, commit=commit))
            if not commit:
                self.saved_forms.append(form)
        return self.new_objects

    def add_fields(self, form, index):
        #CONSIDER there is no parent object, more like a document/instance and a dotpath
        """Add a hidden field for the object's primary key."""
        #TODO
        super(BaseDocumentFormSet, self).add_fields(form, index)


# Path: dockit/forms/forms.py
# class DocumentForm(BaseDocumentForm):
#     """ The document form object """
#     __metaclass__ = DocumentFormMetaClass
# 
# def documentform_factory(document, form=DocumentForm, fields=None, exclude=None,
#                              formfield_callback=None, schema=None, dotpath=None):
#     meta = UserMeta(document=document,
#                     fields=fields,
#                     exclude=exclude,
#                     formfield_callback=formfield_callback,
#                     schema=schema,
#                     dotpath=dotpath,)
#     class FactoryForm(form):
#         Meta = meta
#     
#     return FactoryForm


# Path: dockit/forms/formsets.py
from django.forms.formsets import BaseFormSet, formset_factory
from django.utils.translation import ugettext_lazy as _, ugettext
from dockit.forms.forms import DocumentForm, documentform_factory

                self.deleted_objects.append(obj)
                #obj.delete()
                continue
            if form.has_changed():
                self.changed_objects.append((obj, form.changed_data))
            saved_instances.append(self.save_existing(form, obj, commit=commit))
            if not commit:
                self.saved_forms.append(form)
        return saved_instances

    def save_new_objects(self, commit=True):
        self.new_objects = []
        for form in self.extra_forms:
            if not form.has_changed():
                continue
            # If someone has marked an add form for deletion, don't save the
            # object.
            if self.can_delete and self._should_delete_form(form):
                continue
            self.new_objects.append(self.save_new(form, commit=commit))
            if not commit:
                self.saved_forms.append(form)
        return self.new_objects

    def add_fields(self, form, index):
        #CONSIDER there is no parent object, more like a document/instance and a dotpath
        """Add a hidden field for the object's primary key."""
        #TODO
        super(BaseDocumentFormSet, self).add_fields(form, index)


def documentformset_factory(document, form=DocumentForm, formfield_callback=None,