convert as_manager hooks to base class hook#2282
Conversation
flaeppe
left a comment
There was a problem hiding this comment.
I have one thought: doesn't this only apply if as_manager comes from django.db.models.QuerySet or if as_manager is generated by the plugin?
I just mean that the plugin behaviour is probably undefined if as_manager has been explicitly overridden by a user. And in that case we could just exit. Or what do you think?
It's probably a check between the attribute symbol.plugin_generated and perhaps queryset_info.get_containing_type_info if we want to do this.
I had a quick look here: https://grep.app/search?q=def%20as_manager%28&case=true&filter[lang][0]=Python and none with a runtime overrides as_manager. It's not a critical case in any way, was just a thought
flaeppe
left a comment
There was a problem hiding this comment.
Ah, nvm, I found the comment and exit now:
# either a manual `as_manager` definition or this is a deferral pass
finished my idea from #2281 (comment) !
I was getting hung up on overriding methods in inherited querysets -- now it pulls the return type from the base queryset and inherits from that directly