diff --git a/django-stubs/db/models/functions/datetime.pyi b/django-stubs/db/models/functions/datetime.pyi index b2469e33e..8e96e0a41 100644 --- a/django-stubs/db/models/functions/datetime.pyi +++ b/django-stubs/db/models/functions/datetime.pyi @@ -1,7 +1,12 @@ +from datetime import tzinfo from typing import Any, ClassVar from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models import Func, Transform +from django.db.models.expressions import Expression +from django.db.models.fields import Field +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType class TimezoneMixin: tzinfo: Any @@ -33,7 +38,21 @@ class TruncBase(TimezoneMixin, Transform): kind: str tzinfo: Any -class Trunc(TruncBase): ... + def __init__( + self, expression: Expression, output_field: Field | None = ..., tzinfo: tzinfo | None = ..., **extra: Any + ) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class Trunc(TruncBase): + def __init__( + self, + expression: Expression, + kind: str, + output_field: Field | None = ..., + tzinfo: tzinfo | None = ..., + **extra: Any, + ) -> None: ... + class TruncYear(TruncBase): ... class TruncQuarter(TruncBase): ... class TruncMonth(TruncBase): ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 2d9c54d71..515d15e9c 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -1051,9 +1051,6 @@ django.db.models.functions.Pi.as_oracle django.db.models.functions.Radians.as_oracle django.db.models.functions.Random django.db.models.functions.Round.__init__ -django.db.models.functions.Trunc.__init__ -django.db.models.functions.TruncDate.as_sql -django.db.models.functions.TruncTime.as_sql django.db.models.functions.comparison.Cast.as_mysql django.db.models.functions.comparison.Cast.as_oracle django.db.models.functions.comparison.Cast.as_postgresql @@ -1070,12 +1067,7 @@ django.db.models.functions.datetime.Extract.as_sql django.db.models.functions.datetime.Extract.lookup_name django.db.models.functions.datetime.Now.as_mysql django.db.models.functions.datetime.Now.as_postgresql -django.db.models.functions.datetime.Trunc.__init__ -django.db.models.functions.datetime.TruncBase.__init__ -django.db.models.functions.datetime.TruncBase.as_sql django.db.models.functions.datetime.TruncBase.kind -django.db.models.functions.datetime.TruncDate.as_sql -django.db.models.functions.datetime.TruncTime.as_sql django.db.models.functions.math.Ceil.as_oracle django.db.models.functions.math.Cot.as_oracle django.db.models.functions.math.Degrees.as_oracle