Closed johhnry closed 2 years ago
Ah ok I missed that point in the README:
# patch.py
import types
from typing import Any, Generic, Type, TypeVar
from mongoengine import Document, QuerySet
from mongoengine.queryset.queryset import QuerySet
T = TypeVar("T")
def no_op(self: T, x: Any) -> T:
return self
QuerySet.__class_getitem__ = types.MethodType(no_op, QuerySet)
U = TypeVar("U", bound=Document)
class QuerySetManager(Generic[U]):
def __get__(self, instance: object, cls: Type[U]) -> QuerySet[U]:
return QuerySet(cls, cls._get_collection())
It works now!
Hi,
I am using Python
3.10.4
and Poetry1.1.13
and I have the following dependencies:And a simple test project:
I have the following error when launching it:
Did I do something wrong?
Thanks!