Plain is headed towards 1.0! Subscribe for development updates →

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