使用 mongodb 和基于 class 的视图 django

Using mongodb with class-based view django

我尝试使用基于 class 的视图,如下所示

class DetailBookVIew(DetailView):
    model = Book
    template_name = 'book/detail_book.html'

with 模型 Book 是一个 mongodb 模型,所以我如何将基于 class 的视图与 mongodb 模型一起使用,因为它会导致像 AttributeError: type object 'Book' has no attribute '_default_manager'_default_manager 属性仅适用于 sql 型号。

您应该使用 Django-mongogeneric 来使用 Document 而不是 Generic viewsModel =16=].