Access super().objects

35 views
Skip to first unread message

Stephane Rainville

unread,
Feb 20, 2021, 1:23:25 AM2/20/21
to MongoEngine Users
I have a defined a new document class

class MyNewDoc(Document):
    meta = {"abstract": True,}

I'm trying to intercept the calls to "objects" to inject query parameters into the query as if it was a middleware.

   @classmethod
    def objects(cls, **kwargs):
      # manipulate kwargs here
     return super().objects       # super has no attribute objects

No sucess

My other idea is to instantiate a QuerySetmanager and call filter but so far no sucess.

Any hints?

Priyansh Singh

unread,
Feb 20, 2021, 1:33:08 AM2/20/21
to mongoeng...@googlegroups.com
Yeah using query set manager is correct way to go

--
You received this message because you are subscribed to the Google Groups "MongoEngine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoengine-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongoengine-users/29ff8487-ec12-4701-b9a3-3df672a6ff47n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages