Fix QuerySet.create and Manager.create annotation since it doesn't accept *args (only **kwargs) (#762)

This commit is contained in:
Kevin Marsh
2021-11-30 07:37:54 -08:00
committed by GitHub
parent 593d04d6e9
commit e5361f1e04
3 changed files with 6 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ class BaseManager(Generic[_T]):
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
def get(self, *args: Any, **kwargs: Any) -> _T: ...
def create(self, *args: Any, **kwargs: Any) -> _T: ...
def create(self, **kwargs: Any) -> _T: ...
def bulk_create(
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
) -> List[_T]: ...

View File

@@ -55,7 +55,7 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
def iterator(self, chunk_size: int = ...) -> Iterator[_Row]: ...
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
def get(self, *args: Any, **kwargs: Any) -> _Row: ...
def create(self, *args: Any, **kwargs: Any) -> _T: ...
def create(self, **kwargs: Any) -> _T: ...
def bulk_create(
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
) -> List[_T]: ...

View File

@@ -371,8 +371,8 @@
from django.db import models
class MyModelManager(models.Manager):
def create(self, *args, **kwargs) -> 'MyModel':
return super().create(*args, **kwargs)
def create(self, **kwargs) -> 'MyModel':
return super().create(**kwargs)
class MyModel(models.Model):
@@ -392,8 +392,8 @@
from django.db import models
class MyModelManager(models.Manager['MyModel']):
def create(self, *args, **kwargs) -> 'MyModel':
return super().create(*args, **kwargs)
def create(self, **kwargs) -> 'MyModel':
return super().create(**kwargs)
class MyModel(models.Model):