You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve stubs for flatten and flatten_fieldsets (#2572)
* Add new `_ListDisplayT` type alias
This renames `_DisplayT` to `_ListDisplayT` and creates a new
`_DisplayT` alias with the contents of the `_ListOrTuple`.
This will be used in the next commit.
* Improve stubs for `flatten` and `flatten_fieldsets`
These functions are implemented in a generic way that doesn't
generally care about the content. The existing return type of
`Callable | str` makes these awkward to use.
I've changed the use of `Sequence` in the `_FieldGroups` alias to use
`_ListOrTuple`. This is another case where `ModelAdmin.fields` and the
`"fields"` item in fieldsets are presumed by Django to be a `list` or
`tuple`, e.g. there are some system checks that ensure this.
See https://github.com/django/django/blob/afbb8c709d40e77b3f71c152d363c5ad95ceec2d/django/contrib/admin/utils.py#L102-L120
0 commit comments