Skip to content

typing support #107

Open
Open
@prokoptsev

Description

@prokoptsev

Hi!
How to make library friends with mypy?
For example if I use code from readme

class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
    def toolfunc(self, request: HttpRequest, obj: MyModel) -> None:
        pass
    toolfunc.label = "This will be the label of the button"
    toolfunc.short_description = "This will be the tooltip of the button"

I catch this error from mypy:

"Callable[[MyModelAdmin, HttpRequest, MyModel], None]" has no attribute "label"
"Callable[[MyModelAdmin, HttpRequest, MyModel], None]" has no attribute "short_description"

For example for django admin short_description and etc. I use django-admin-display. How do you look at adding something like this to your project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions