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: Pass positional args name and violation_error_message to BaseConstraint #1974

Merged
merged 2 commits into from
Feb 25, 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
14 changes: 12 additions & 2 deletions django-stubs/db/models/constraints.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from django.db.models.base import Model
from django.db.models.expressions import BaseExpression, Combinable
from django.db.models.query_utils import Q
from django.utils.functional import _StrOrPromise
from typing_extensions import Self
from typing_extensions import Self, deprecated

class Deferrable(Enum):
DEFERRED: str
Expand All @@ -18,8 +18,18 @@ class BaseConstraint:
violation_error_code: str | None
violation_error_message: _StrOrPromise | None
default_violation_error_message: _StrOrPromise
@overload
def __init__(
self, *, name: str, violation_error_code: str | None = ..., violation_error_message: _StrOrPromise | None = ...
) -> None: ...
@overload
@deprecated("Passing positional arguments to BaseConstraint is deprecated and will be removed in Django 6.0")
def __init__(
self, name: str, violation_error_code: str | None = ..., violation_error_message: _StrOrPromise | None = ...
self,
*args: Any,
name: str | None = ...,
violation_error_code: str | None = ...,
violation_error_message: _StrOrPromise | None = ...,
) -> None: ...
def constraint_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ...
def create_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ...
Expand Down
3 changes: 0 additions & 3 deletions scripts/stubtest/allowlist_todo_django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ django.contrib.gis.admin.OpenLayersWidget
django.contrib.gis.admin.options.spherical_mercator_srid
django.contrib.gis.admin.widgets
django.contrib.gis.db.backends.spatialite.schema.SpatialiteSchemaEditor.alter_db_table
django.contrib.gis.db.models.BaseConstraint.__init__
django.contrib.gis.db.models.Case.allowed_default
django.contrib.gis.db.models.ExpressionWrapper.allowed_default
django.contrib.gis.db.models.F.allowed_default
Expand Down Expand Up @@ -149,7 +148,6 @@ django.db.backends.sqlite3.schema.DatabaseSchemaEditor.sql_alter_column_comment
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.sql_alter_table_comment
django.db.backends.utils.CursorWrapper.APPS_NOT_READY_WARNING_MSG
django.db.migrations.serializer.BaseUnorderedSequenceSerializer
django.db.models.BaseConstraint.__init__
django.db.models.Case.allowed_default
django.db.models.ExpressionWrapper.allowed_default
django.db.models.F.allowed_default
Expand All @@ -168,7 +166,6 @@ django.db.models.Prefetch.get_current_querysets
django.db.models.Q.identity
django.db.models.Value.allowed_default
django.db.models.When.allowed_default
django.db.models.constraints.BaseConstraint.__init__
django.db.models.expressions.BaseExpression.allowed_default
django.db.models.expressions.Case.allowed_default
django.db.models.expressions.CombinedExpression.allowed_default
Expand Down