mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 20:24:31 +08:00
Add support for exclusion constraints (#249)
This commit is contained in:
committed by
Maksim Kurnikov
parent
58b26fdbd3
commit
f5f33b061d
18
django-stubs/contrib/postgres/constraints.pyi
Normal file
18
django-stubs/contrib/postgres/constraints.pyi
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from typing import Optional, Sequence, Tuple, Union
|
||||||
|
|
||||||
|
from django.db.models.constraints import BaseConstraint
|
||||||
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.query_utils import Q
|
||||||
|
|
||||||
|
class ExclusionConstraint(BaseConstraint):
|
||||||
|
expressions: Sequence[Tuple[Union[str, Combinable], str]]
|
||||||
|
index_type: str
|
||||||
|
condition: Optional[Q]
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
name: str,
|
||||||
|
expressions: Sequence[Tuple[Union[str, Combinable], str]],
|
||||||
|
condition: Optional[Q] = ...,
|
||||||
|
index_type: Optional[str] = ...,
|
||||||
|
): ...
|
||||||
@@ -8,6 +8,7 @@ from .ranges import (
|
|||||||
FloatRangeField as FloatRangeField,
|
FloatRangeField as FloatRangeField,
|
||||||
DateRangeField as DateRangeField,
|
DateRangeField as DateRangeField,
|
||||||
DateTimeRangeField as DateTimeRangeField,
|
DateTimeRangeField as DateTimeRangeField,
|
||||||
|
RangeOperators as RangeOperators,
|
||||||
)
|
)
|
||||||
from .hstore import HStoreField as HStoreField
|
from .hstore import HStoreField as HStoreField
|
||||||
from .citext import (
|
from .citext import (
|
||||||
|
|||||||
@@ -29,3 +29,15 @@ class DateTimeRangeField(RangeField):
|
|||||||
|
|
||||||
class DateRangeField(RangeField):
|
class DateRangeField(RangeField):
|
||||||
def __get__(self, instance, owner) -> DateRange: ...
|
def __get__(self, instance, owner) -> DateRange: ...
|
||||||
|
|
||||||
|
class RangeOperators:
|
||||||
|
EQUAL: str
|
||||||
|
NOT_EQUAL: str
|
||||||
|
CONTAINS: str
|
||||||
|
CONTAINED_BY: str
|
||||||
|
OVERLAPS: str
|
||||||
|
FULLY_LT: str
|
||||||
|
FULLY_GT: str
|
||||||
|
NOT_LT: str
|
||||||
|
NOT_GT: str
|
||||||
|
ADJACENT_TO: str
|
||||||
|
|||||||
@@ -96,6 +96,7 @@
|
|||||||
import django.contrib.postgres.aggregates.general
|
import django.contrib.postgres.aggregates.general
|
||||||
import django.contrib.postgres.aggregates.mixins
|
import django.contrib.postgres.aggregates.mixins
|
||||||
import django.contrib.postgres.aggregates.statistics
|
import django.contrib.postgres.aggregates.statistics
|
||||||
|
import django.contrib.postgres.constraints
|
||||||
import django.contrib.postgres.fields
|
import django.contrib.postgres.fields
|
||||||
import django.contrib.postgres.fields.array
|
import django.contrib.postgres.fields.array
|
||||||
import django.contrib.postgres.fields.citext
|
import django.contrib.postgres.fields.citext
|
||||||
|
|||||||
Reference in New Issue
Block a user