mirror of
https://github.com/django/django.git
synced 2025-08-06 03:48:38 +00:00
Refs #33342 -- Deprecated ExclusionConstraint.opclasses.
This commit is contained in:
parent
ff225fac1d
commit
59a66f0512
5 changed files with 247 additions and 82 deletions
|
@ -1,3 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from django.contrib.postgres.indexes import OpClass
|
||||
from django.db import NotSupportedError
|
||||
from django.db.backends.ddl_references import Expressions, Statement, Table
|
||||
|
@ -6,6 +8,7 @@ from django.db.models.constraints import BaseConstraint
|
|||
from django.db.models.expressions import ExpressionList
|
||||
from django.db.models.indexes import IndexExpression
|
||||
from django.db.models.sql import Query
|
||||
from django.utils.deprecation import RemovedInDjango50Warning
|
||||
|
||||
__all__ = ['ExclusionConstraint']
|
||||
|
||||
|
@ -67,6 +70,14 @@ class ExclusionConstraint(BaseConstraint):
|
|||
self.deferrable = deferrable
|
||||
self.include = tuple(include) if include else ()
|
||||
self.opclasses = opclasses
|
||||
if self.opclasses:
|
||||
warnings.warn(
|
||||
'The opclasses argument is deprecated in favor of using '
|
||||
'django.contrib.postgres.indexes.OpClass in '
|
||||
'ExclusionConstraint.expressions.',
|
||||
category=RemovedInDjango50Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super().__init__(name=name)
|
||||
|
||||
def _get_expressions(self, schema_editor, query):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue