Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fields type in bulk_update #822

Closed
jerch opened this issue Jan 16, 2022 · 1 comment
Closed

fields type in bulk_update #822

jerch opened this issue Jan 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jerch
Copy link

jerch commented Jan 16, 2022

Bug report

What's wrong

The fields argument in bulk_update is typed as Sequence[str]:

def bulk_update(self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ...) -> int: ...

This prevents using Set[str], as it is not a subtype of Sequence (thats my actual issue with it).

How is that should be

Looking at the django source bulk_update transforms the fields argument by a list comprehension early, thus any iterable should work here. I suggest to widen the type info to Iterable[str].

@jerch jerch added the bug Something isn't working label Jan 16, 2022
@sobolevn
Copy link
Member

PR is welcome.

himanshu-balasamanta added a commit to himanshu-balasamanta/django-stubs that referenced this issue Mar 10, 2022
Signed-off-by: Himanshu-Balasamanta <[email protected]>
himanshu-balasamanta added a commit to himanshu-balasamanta/django-stubs that referenced this issue Mar 12, 2022
Signed-off-by: Himanshu-Balasamanta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants