def __init__(self, options=None):

        try:
            self.document = getattr(options, 'document')
        except __HOLE__:
            raise AttributeError("DocumentForm must specify a document class.")

        try:
            self.document.collection
        except AttributeError:
            pass
        else:
            raise TypeError("Document must not be bound to a collection.")

        self.fields = getattr(options, 'fields', None)
        self.exclude = getattr(options, 'exclude', None)
dataset/ETHPy150Open peterbe/django-mongokit/django_mongokit/forms/forms.py/DocumentFormOptions.__init__