# Path: dockit/schema/exceptions.py
# class DotPathNotFound(Exception):
#     def __init__(self, message, traverser=None):
#         Exception.__init__(self, message)
#         self.traverser = traverser


from django.utils.datastructures import SortedDict
from django.forms.util import ErrorList
from django.forms.forms import BaseForm, get_declared_fields, ValidationError
from django.forms.widgets import media_property
from dockit.schema.exceptions import DotPathNotFound
import inspect
* BooleanProperty  ->  BooleanField,
* FloatProperty    ->  FloatField,
* DateTimeProperty ->  DateTimeField,
* DateProperty     ->  DateField,
* TimeProperty     ->  TimeField


More fields types will be supported soon.
"""




def document_to_dict(document, instance, properties=None, exclude=None, dotpath=None):
    """
    Returns a dict containing the data in ``instance`` suitable for passing as
    a Form's ``initial`` keyword argument.

    ``properties`` is an optional list of properties names. If provided, 
    only the named properties will be included in the returned dict.

    ``exclude`` is an optional list of properties names. If provided, the named
    properties will be excluded from the returned dict, even if they are listed 
    in the ``properties`` argument.
    """
    # avoid a circular import
    data = {}
    if dotpath:
        try:
            src_data = instance.dot_notation(dotpath)

# Path: dockit/schema/exceptions.py
# class DotPathNotFound(Exception):
#     def __init__(self, message, traverser=None):
#         Exception.__init__(self, message)
#         self.traverser = traverser


# Path: dockit/forms/forms.py
from django.utils.datastructures import SortedDict
from django.forms.util import ErrorList
from django.forms.forms import BaseForm, get_declared_fields, ValidationError
from django.forms.widgets import media_property
from dockit.schema.exceptions import DotPathNotFound
import inspect

* BooleanProperty  ->  BooleanField,
* FloatProperty    ->  FloatField,
* DateTimeProperty ->  DateTimeField,
* DateProperty     ->  DateField,
* TimeProperty     ->  TimeField


More fields types will be supported soon.
"""




def document_to_dict(document, instance, properties=None, exclude=None, dotpath=None):
    """
    Returns a dict containing the data in ``instance`` suitable for passing as
    a Form's ``initial`` keyword argument.

    ``properties`` is an optional list of properties names. If provided, 
    only the named properties will be included in the returned dict.

    ``exclude`` is an optional list of properties names. If provided, the named
    properties will be excluded from the returned dict, even if they are listed 
    in the ``properties`` argument.
    """
    # avoid a circular import
    data = {}
    if dotpath:
        try:
            src_data = instance.dot_notation(dotpath)

        except DotPathNotFound: