|
@@ -25,19 +25,9 @@ class BaseConstraint:
|
|
|
|
|
|
non_db_attrs = ("violation_error_code", "violation_error_message")
|
|
|
|
|
|
- # RemovedInDjango60Warning: When the deprecation ends, replace with:
|
|
|
- # def __init__(
|
|
|
- # self, *, name, violation_error_code=None, violation_error_message=None
|
|
|
- # ):
|
|
|
def __init__(
|
|
|
- self, *args, name=None, violation_error_code=None, violation_error_message=None
|
|
|
+ self, *, name, violation_error_code=None, violation_error_message=None
|
|
|
):
|
|
|
- # RemovedInDjango60Warning.
|
|
|
- if name is None and not args:
|
|
|
- raise TypeError(
|
|
|
- f"{self.__class__.__name__}.__init__() missing 1 required keyword-only "
|
|
|
- f"argument: 'name'"
|
|
|
- )
|
|
|
self.name = name
|
|
|
if violation_error_code is not None:
|
|
|
self.violation_error_code = violation_error_code
|
|
@@ -45,17 +35,6 @@ class BaseConstraint:
|
|
|
self.violation_error_message = violation_error_message
|
|
|
else:
|
|
|
self.violation_error_message = self.default_violation_error_message
|
|
|
- # RemovedInDjango60Warning.
|
|
|
- if args:
|
|
|
- warnings.warn(
|
|
|
- f"Passing positional arguments to {self.__class__.__name__} is "
|
|
|
- f"deprecated.",
|
|
|
- RemovedInDjango60Warning,
|
|
|
- stacklevel=2,
|
|
|
- )
|
|
|
- for arg, attr in zip(args, ["name", "violation_error_message"]):
|
|
|
- if arg:
|
|
|
- setattr(self, attr, arg)
|
|
|
|
|
|
@property
|
|
|
def contains_expressions(self):
|