Bug: LazyReferenceField passthrough on classes with methods do not work
ErikBrendel opened this issue · 1 comments
ErikBrendel commented
I have a LazyReferenceField
to a document class that I want to call methods on, but that does not work, because the __getattr__
method of a LazyReference
is implemented via the subscript operator instead of a getattr
call.
Relevant line: https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/base/datastructures.py#L468
Replacing return document[name]
with return getattr(document, name)
would solve the problem.
bagerard commented
Please open a PR and don't forget to add test cases