Plain is headed towards 1.0! Subscribe for development updates →

  1from . import (
  2    preflight,  # noqa
  3)
  4from .aggregates import *  # NOQA
  5from .aggregates import __all__ as aggregates_all
  6from .constraints import *  # NOQA
  7from .constraints import __all__ as constraints_all
  8from .db import (
  9    PLAIN_VERSION_PICKLE_KEY,
 10    DatabaseError,
 11    DataError,
 12    Error,
 13    IntegrityError,
 14    InterfaceError,
 15    InternalError,
 16    NotSupportedError,
 17    OperationalError,
 18    ProgrammingError,
 19    close_old_connections,
 20    db_connection,
 21    reset_queries,
 22)
 23from .deletion import (
 24    CASCADE,
 25    DO_NOTHING,
 26    PROTECT,
 27    RESTRICT,
 28    SET,
 29    SET_DEFAULT,
 30    SET_NULL,
 31    ProtectedError,
 32    RestrictedError,
 33)
 34from .enums import *  # NOQA
 35from .enums import __all__ as enums_all
 36from .expressions import (
 37    Case,
 38    Exists,
 39    Expression,
 40    ExpressionList,
 41    ExpressionWrapper,
 42    F,
 43    Func,
 44    OrderBy,
 45    OuterRef,
 46    RowRange,
 47    Subquery,
 48    Value,
 49    ValueRange,
 50    When,
 51    Window,
 52    WindowFrame,
 53)
 54from .fields import *  # NOQA
 55from .fields import __all__ as fields_all
 56from .fields.json import JSONField
 57from .indexes import *  # NOQA
 58from .indexes import __all__ as indexes_all
 59from .lookups import Lookup, Transform
 60from .query import Prefetch, QuerySet, prefetch_related_objects
 61from .query_utils import FilteredRelation, Q
 62from .registry import models_registry, register_model
 63
 64# Imports that would create circular imports if sorted
 65from .base import DEFERRED, Model  # isort:skip
 66from .options import Options  # isort:skip
 67from .fields.related import (  # isort:skip
 68    ForeignKey,
 69    ManyToManyField,
 70)
 71from .fields.reverse_related import (  # isort:skip
 72    ForeignObjectRel,
 73    ManyToOneRel,
 74    ManyToManyRel,
 75)
 76
 77
 78__all__ = aggregates_all + constraints_all + enums_all + fields_all + indexes_all
 79__all__ += [
 80    "CASCADE",
 81    "DO_NOTHING",
 82    "PROTECT",
 83    "RESTRICT",
 84    "SET",
 85    "SET_DEFAULT",
 86    "SET_NULL",
 87    "ProtectedError",
 88    "RestrictedError",
 89    "Case",
 90    "Exists",
 91    "Expression",
 92    "ExpressionList",
 93    "ExpressionWrapper",
 94    "F",
 95    "Func",
 96    "OrderBy",
 97    "OuterRef",
 98    "RowRange",
 99    "Subquery",
100    "Value",
101    "ValueRange",
102    "When",
103    "Window",
104    "WindowFrame",
105    "JSONField",
106    "Lookup",
107    "Transform",
108    "Options",
109    "Prefetch",
110    "Q",
111    "QuerySet",
112    "prefetch_related_objects",
113    "DEFERRED",
114    "Model",
115    "FilteredRelation",
116    "ForeignKey",
117    "ManyToManyField",
118    "ForeignObjectRel",
119    "ManyToOneRel",
120    "ManyToManyRel",
121]
122
123# DB-related exports
124__all__ += [
125    "db_connection",
126    "reset_queries",
127    "close_old_connections",
128    "DatabaseError",
129    "IntegrityError",
130    "InternalError",
131    "ProgrammingError",
132    "DataError",
133    "NotSupportedError",
134    "Error",
135    "InterfaceError",
136    "OperationalError",
137    "PLAIN_VERSION_PICKLE_KEY",
138]
139
140# Registry exports
141__all__ += ["register_model", "models_registry"]