示例#1
0
 def register_documents_with_backend(self, documents):
     from dockit.backends import get_document_router
     router = get_document_router()
     
     for document in documents:
         router.register_document(document)
         document_registered.send_robust(sender=document._meta.collection, document=document)
示例#2
0
def _register_document(document_cls):
    if app_cache_ready():
        while document_cls:
            backend = document_cls._meta.get_backend()
            backend.register_document(document_cls)
            register_collection(document_cls)
            document_registered.send_robust(sender=document_cls._meta.collection, document=document_cls)
            if not _pending_registered_documents:
                break
            document_cls = _pending_registered_documents.pop()
    else:
        _pending_registered_documents.append(document_cls)