Skip to content

get_dynamic_class_hook() not invoked on generic types #8359

@mkurnikov

Description

@mkurnikov

In Django, there's a method called as_manager() on QuerySet
https://docs.djangoproject.com/en/3.0/ref/models/querysets/#django.db.models.query.QuerySet.as_manager
which returns an instance of a dynamically created manager with callee QuerySet method copied inside

class AnonymousManager(models.Manager):
    ... methods of QuerySet callee copied ...

I'd like to be able to call it like with generic parameters

MyQuerySet[MyModel].as_manager()

Now, because of clause

            if isinstance(callee_expr, RefExpr) and callee_expr.fullname:
                method_name = call.callee.name
                fname = callee_expr.fullname + '.' + method_name

get_dynamic_class_hook() never called. callee_expr is TypeApplication here, not RefExpr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-pluginsThe plugin API and ideas for new plugins

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions