Это действительно расстраивает.`NotRegistered` Исключение при использовании множественного наследования
Ниже приведены мои определения документов, для того, чтобы иметь Подгруппа документы наследуют от базового класса, я последовал за предложение здесь: https://groups.google.com/forum/#!topic/mongoengine-users/T8lCtGv_IYQ
модели/thread.py
class Thread(object):
meta = {
'allow_inheritance': True
}
модели/форум .py
from models.thread import Thread
from mongoengine import Document
class ForumThread(Document, Thread):
meta = {
'collection': 'forum_threads'
}
модели/group.py
from models.thread import Thread
from mongoengine import Document
class GroupThread(Document, Thread):
meta = {
'collection': 'group_threads'
}
Я получаю NotRegistered
при попытке чего-то подобного;
>>> from models.forum import ForumThread
>>> print ForumThread.objects().first()
>>> NotRegistered: `Thread` has not been registered in the document registry.
Importing the document class automatically registers it, has it
been imported?
Любая помощь/совет были бы высоко оценены.
ли 'Thread' были импортированы? – Kevin
Я обновил свой вопрос, чтобы быть более ясным. – user1236803