mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 20:24:31 +08:00
QuerySet.in_bulk fixes.
- Made id_list of type Sequence[Any], rather than Any, according to mkurnikov's review. - Removed **kwargs. - Made returned Dict keys of type Any rather than int or str as it depends on the provided field's type. - Added test with examples from Django docs.
This commit is contained in:
10
test-data/typecheck/queryset.test
Normal file
10
test-data/typecheck/queryset.test
Normal file
@@ -0,0 +1,10 @@
|
||||
[CASE test_queryset]
|
||||
from django.db import models
|
||||
|
||||
class Blog(models.Model):
|
||||
slug = models.CharField(max_length=100)
|
||||
reveal_type(Blog.objects.in_bulk([1])) # E: Revealed type is 'builtins.dict[Any, main.Blog*]'
|
||||
reveal_type(Blog.objects.in_bulk()) # E: Revealed type is 'builtins.dict[Any, main.Blog*]'
|
||||
reveal_type(Blog.objects.in_bulk(['beatles_blog'], field_name='slug')) # E: Revealed type is 'builtins.dict[Any, main.Blog*]'
|
||||
|
||||
[out]
|
||||
Reference in New Issue
Block a user