Skip to content

Conversation

@Vulwsztyn
Copy link

I have made things!

I improved usage of generics in contrib/admin/filters.pyi

Related issues

I haven't been able to find any.

Copy link
Contributor

@UnknownPlatypus UnknownPlatypus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few open questions

Comment on lines +24 to +26
_ModelT = TypeVar("_ModelT", bound=Model)
_ST = TypeVar("_ST", contravariant=True)
_GT = TypeVar("_GT", covariant=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we / should we share these typevar definition with the other places with matching ones ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference, I have not seen anyone doing it tho

used_parameters: dict[str, bool | datetime | str]
def __init__(
self, request: HttpRequest, params: dict[str, str], model: type[Model], model_admin: ModelAdmin
self, request: HttpRequest, params: dict[str, str], model: type[Model], model_admin: ModelAdmin[_ModelT]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should model also be modelT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, will fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants