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

5.0: Add QuerySet.(a)update_or_create new create_defaults arg #1970

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions django-stubs/db/models/manager.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,17 @@ class BaseManager(Generic[_T]):
async def aget_or_create(
self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any
) -> tuple[_T, bool]: ...
def update_or_create(self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_T, bool]: ...
def update_or_create(
self,
defaults: MutableMapping[str, Any] | None = ...,
create_defaults: MutableMapping[str, Any] | None = ...,
**kwargs: Any,
) -> tuple[_T, bool]: ...
async def aupdate_or_create(
self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any
self,
defaults: MutableMapping[str, Any] | None = ...,
create_defaults: MutableMapping[str, Any] | None = ...,
**kwargs: Any,
) -> tuple[_T, bool]: ...
def earliest(self, *fields: str | OrderBy) -> _T: ...
async def aearliest(self, *fields: str | OrderBy) -> _T: ...
Expand Down
12 changes: 10 additions & 2 deletions django-stubs/db/models/query.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
async def aget_or_create(
self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any
) -> tuple[_T, bool]: ...
def update_or_create(self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_T, bool]: ...
def update_or_create(
self,
defaults: MutableMapping[str, Any] | None = ...,
create_defaults: MutableMapping[str, Any] | None = ...,
**kwargs: Any,
) -> tuple[_T, bool]: ...
async def aupdate_or_create(
self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any
self,
defaults: MutableMapping[str, Any] | None = ...,
create_defaults: MutableMapping[str, Any] | None = ...,
**kwargs: Any,
) -> tuple[_T, bool]: ...
def earliest(self, *fields: str | OrderBy) -> _Row: ...
async def aearliest(self, *fields: str | OrderBy) -> _Row: ...
Expand Down
6 changes: 0 additions & 6 deletions scripts/stubtest/allowlist_todo_django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ django.contrib.gis.db.models.Func.allowed_default
django.contrib.gis.db.models.Lookup.allowed_default
django.contrib.gis.db.models.Prefetch.get_current_querysets
django.contrib.gis.db.models.Q.identity
django.contrib.gis.db.models.QuerySet.aupdate_or_create
django.contrib.gis.db.models.QuerySet.update_or_create
django.contrib.gis.db.models.Value.allowed_default
django.contrib.gis.db.models.When.allowed_default
django.contrib.gis.db.models.functions.ClosestPoint
Expand Down Expand Up @@ -183,8 +181,6 @@ django.db.models.Func.allowed_default
django.db.models.Lookup.allowed_default
django.db.models.Prefetch.get_current_querysets
django.db.models.Q.identity
django.db.models.QuerySet.aupdate_or_create
django.db.models.QuerySet.update_or_create
django.db.models.Value.allowed_default
django.db.models.When.allowed_default
django.db.models.constraints.BaseConstraint.__init__
Expand Down Expand Up @@ -225,8 +221,6 @@ django.db.models.lookups.IntegerLessThan.overflow_exception
django.db.models.lookups.IntegerLessThanOrEqual
django.db.models.lookups.Lookup.allowed_default
django.db.models.query.Prefetch.get_current_querysets
django.db.models.query.QuerySet.aupdate_or_create
django.db.models.query.QuerySet.update_or_create
django.db.models.query_utils.FilteredRelation.relabeled_clone
django.db.models.query_utils.FilteredRelation.resolve_expression
django.db.models.query_utils.Q.identity
Expand Down