plain.models 0.41.1__py3-none-any.whl → 0.42.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plain/models/CHANGELOG.md +17 -0
- plain/models/README.md +65 -22
- plain/models/__init__.py +0 -2
- plain/models/base.py +12 -34
- plain/models/cli.py +16 -22
- plain/models/constraints.py +1 -1
- plain/models/deletion.py +1 -1
- plain/models/fields/__init__.py +1 -1
- plain/models/fields/related.py +1 -4
- plain/models/fields/related_descriptors.py +57 -53
- plain/models/fields/related_lookups.py +2 -2
- plain/models/fields/reverse_related.py +1 -1
- plain/models/forms.py +1 -1
- plain/models/migrations/autodetector.py +0 -18
- plain/models/migrations/operations/__init__.py +0 -2
- plain/models/migrations/operations/models.py +3 -57
- plain/models/migrations/operations/special.py +2 -8
- plain/models/migrations/recorder.py +1 -1
- plain/models/migrations/serializer.py +0 -12
- plain/models/migrations/state.py +1 -55
- plain/models/options.py +23 -86
- plain/models/query.py +10 -41
- plain/models/query_utils.py +1 -1
- plain/models/sql/compiler.py +5 -5
- plain/models/sql/query.py +2 -2
- {plain_models-0.41.1.dist-info → plain_models-0.42.0.dist-info}/METADATA +66 -23
- {plain_models-0.41.1.dist-info → plain_models-0.42.0.dist-info}/RECORD +30 -31
- plain/models/manager.py +0 -176
- {plain_models-0.41.1.dist-info → plain_models-0.42.0.dist-info}/WHEEL +0 -0
- {plain_models-0.41.1.dist-info → plain_models-0.42.0.dist-info}/entry_points.txt +0 -0
- {plain_models-0.41.1.dist-info → plain_models-0.42.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,31 +1,30 @@
|
|
1
1
|
plain/models/AGENTS.md,sha256=xQQW-z-DehnCUyjiGSBfLqUjoSUdo_W1b0JmwYmWieA,209
|
2
|
-
plain/models/CHANGELOG.md,sha256=
|
3
|
-
plain/models/README.md,sha256=
|
4
|
-
plain/models/__init__.py,sha256=
|
2
|
+
plain/models/CHANGELOG.md,sha256=LteqCcJPqB5SD3TXZU5wzkOX80mNbxUboILDdhN1tjk,13165
|
3
|
+
plain/models/README.md,sha256=lqzWJrEIxBCHC1P8X1YoRjbsMFlu0-kG4ujP76B_ZO4,8572
|
4
|
+
plain/models/__init__.py,sha256=aB9HhIKBh0iK3LZztInAE-rDF-yKsdfcjfMtwtN5vnI,2920
|
5
5
|
plain/models/aggregates.py,sha256=P0mhsMl1VZt2CVHMuCHnNI8SxZ9citjDLEgioN6NOpo,7240
|
6
|
-
plain/models/base.py,sha256=
|
7
|
-
plain/models/cli.py,sha256=
|
6
|
+
plain/models/base.py,sha256=stIpRkXfgeQqJ8Mq_EMjP-g_hw_nbKyX7Z6OLhFk_TM,66087
|
7
|
+
plain/models/cli.py,sha256=lhvlw7DVOU3CVoMUpHaj7qIbQ2d6qtSm_l9PdCeCnc0,36404
|
8
8
|
plain/models/config.py,sha256=OF7eIEtXNZyGwgc3eMEpb5uEAup5RXeT-0um60dfBeU,636
|
9
9
|
plain/models/connections.py,sha256=RBNa2FZ0x3C9un6PaYL-IYzH_OesRSpdHNGKvYHGiOM,2276
|
10
10
|
plain/models/constants.py,sha256=ndnj9TOTKW0p4YcIPLOLEbsH6mOgFi6B1-rIzr_iwwU,210
|
11
|
-
plain/models/constraints.py,sha256=
|
11
|
+
plain/models/constraints.py,sha256=Mm9gm5D7EKmo486dL481-hrTcxi2gxgqyUUtbGrkLjs,16749
|
12
12
|
plain/models/database_url.py,sha256=iidKVhOylf5N6t1EMPRySRQiv6LiuRjYRECB_UJ3MI8,6419
|
13
13
|
plain/models/db.py,sha256=FpdfLYrRX2THUzDy4QdJ_OpSo9IFKLerZIEQ-T2x8zA,1348
|
14
14
|
plain/models/default_settings.py,sha256=cDym1o_DtHySWgDRIdjgEM0YxjgYU51ZqzWVA3vpzTk,569
|
15
|
-
plain/models/deletion.py,sha256=
|
15
|
+
plain/models/deletion.py,sha256=3eW3bb39NbIlIAp4ZAEtSZuiy9oH4i5e83OK_8oIaxI,17607
|
16
16
|
plain/models/entrypoints.py,sha256=EC14mW19tK9dCumaNHnv4_9jQV8jomQ8jXy8Ib89VBw,191
|
17
17
|
plain/models/enums.py,sha256=Zr-JKt2aeYsSADtAm69fDRfajS7jYwop2vWQVLJ9YYI,2726
|
18
18
|
plain/models/exceptions.py,sha256=IqzK60-hY3TYsgOMxlWwgpVa21E7ydC-gqUG4tNvVJc,2042
|
19
19
|
plain/models/expressions.py,sha256=hN6sfOxqxpP0qmYOUotsFAAn2-bnl35iHwyINyXA7CI,62763
|
20
|
-
plain/models/forms.py,sha256=
|
20
|
+
plain/models/forms.py,sha256=VreclYMITYh3D-sfZV3iSQH9QjNmwNwIYQL_90owOVM,25805
|
21
21
|
plain/models/indexes.py,sha256=fazIZPJgCX5_Bhwk7MQy3YbWOxpHvaCe1dDLGGldTuY,11540
|
22
22
|
plain/models/lookups.py,sha256=eCsxQXUcOoAa_U_fAAd3edcgXI1wfyFW8hPgUh8TwTo,24776
|
23
|
-
plain/models/
|
24
|
-
plain/models/options.py,sha256=1EtFAXG3RqwoT8DzRKUmZvfXlhk98MvCf4q4FG6jBN4,23572
|
23
|
+
plain/models/options.py,sha256=BOnu9NDVcgL0tJhan5gBbaK1SWNeg4NVTPNAzkKT3NE,21528
|
25
24
|
plain/models/otel.py,sha256=36QSJS6UXv1YPJTqeSmEvdMVHRkXa_zgqqItJaXc59g,7619
|
26
25
|
plain/models/preflight.py,sha256=PlS1S2YHEpSKZ57KbTP6TbED98dDDXYSBUk6xMIpgsI,8136
|
27
|
-
plain/models/query.py,sha256=
|
28
|
-
plain/models/query_utils.py,sha256=
|
26
|
+
plain/models/query.py,sha256=6t0ow7oQfVB6WiC3fQ3kLme8TBeSOscEt5xl2lu6oOQ,89703
|
27
|
+
plain/models/query_utils.py,sha256=zxAdfwDbOmaN_SJODl4Wl9gs-q2EzOjXbsBFTWWhh8g,14174
|
29
28
|
plain/models/registry.py,sha256=5yxVgT_W8GlyL2bsGT2HvMQB5sKolXucP2qrhr7Wlnk,8126
|
30
29
|
plain/models/transaction.py,sha256=KqkRDT6aqMgbPA_ch7qO8a9NyDvwY_2FaxM7FkBkcgY,9357
|
31
30
|
plain/models/utils.py,sha256=rD47CAMH4SsznTe-kUnRUdnaZeZHVv1fwLUiU3KOFW0,1630
|
@@ -72,13 +71,13 @@ plain/models/backups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
72
71
|
plain/models/backups/cli.py,sha256=AKVh_Go0LxnxFi2jQjmpPEbbJvYCurjJsGCWESm1X8A,2960
|
73
72
|
plain/models/backups/clients.py,sha256=WQ4X4KrkNeiKYJcpGRwnfRiAeeyduHWEnq4tA4mtjvw,4047
|
74
73
|
plain/models/backups/core.py,sha256=09IZUhBEe1Yej3PC8AidtkaI0c8tt7VnqGBCWK-WrFg,3318
|
75
|
-
plain/models/fields/__init__.py,sha256=
|
74
|
+
plain/models/fields/__init__.py,sha256=HrGTFOeG8Bt5pHWmiClmdn1qZcvCOIcXx4a5RKiIdr4,77938
|
76
75
|
plain/models/fields/json.py,sha256=OdGW4EYBSHQgkuugB-EiIXOqGstUqcMKUvOTOVUHqEQ,18049
|
77
76
|
plain/models/fields/mixins.py,sha256=K_ocrSbb6pPuGwYZeqgzoZskwCIMFIB6IV3T5CrU5J0,1805
|
78
|
-
plain/models/fields/related.py,sha256=
|
79
|
-
plain/models/fields/related_descriptors.py,sha256=
|
80
|
-
plain/models/fields/related_lookups.py,sha256=
|
81
|
-
plain/models/fields/reverse_related.py,sha256=
|
77
|
+
plain/models/fields/related.py,sha256=a7uWotXOwAUJForwSTqTlspLH-svC8uUPxZnNAp-6lM,50936
|
78
|
+
plain/models/fields/related_descriptors.py,sha256=KSdMKBk9x8mMZN6pofjZlo8M5VHe-JIitMXnkBRO6lw,39158
|
79
|
+
plain/models/fields/related_lookups.py,sha256=9y6AfEcg8xRRZne2LXFP6jym9mecFlB_toYih7lD8Uw,7781
|
80
|
+
plain/models/fields/reverse_related.py,sha256=a84mXwpxRNPJoT0P0dJz4ibXwyTZoZxS-DjbI_EyAPs,10756
|
82
81
|
plain/models/functions/__init__.py,sha256=aglCm_JtzDYk2KmxubDN_78CGG3JCfRWnfJ74Oj5YJ4,2658
|
83
82
|
plain/models/functions/comparison.py,sha256=9uAiEuNXZiGFzJKBvktsHwx58Qpa2cPQkr6pUWsGcKo,6554
|
84
83
|
plain/models/functions/datetime.py,sha256=ov1H0Oq9qHSeu8L5CZsln0_SMU2C5M_P5HvKxppA24o,13089
|
@@ -87,7 +86,7 @@ plain/models/functions/mixins.py,sha256=s6H0Ejugo8707EnxN6zS4givmTbPrFuk3Q_mqCGQ
|
|
87
86
|
plain/models/functions/text.py,sha256=Vn4Rh-cVJCL4NUaBcj72cwHa6yHap5ql0XPwn0-K_tc,8908
|
88
87
|
plain/models/functions/window.py,sha256=3S0QIZc_pIVcWpE5Qq-OxixmtATLb8rZrWkvCfVtJ7Q,2809
|
89
88
|
plain/models/migrations/__init__.py,sha256=ZAQUGrfr_OxYMIO7vUBIHLs_M3oZ4iQSjDzCHRFUdtI,96
|
90
|
-
plain/models/migrations/autodetector.py,sha256=
|
89
|
+
plain/models/migrations/autodetector.py,sha256=MuJEVaU9IZ8c6HfcDsEANNujUrSGMN-iDd5WDPM7ht8,60957
|
91
90
|
plain/models/migrations/exceptions.py,sha256=_bGjIMaBP2Py9ePUxUhiH0p1zXrQM4JhJO4lWfyF8-g,1044
|
92
91
|
plain/models/migrations/executor.py,sha256=2_1bWM7Dp3s8z6PADAEN-Y0KnIiRzAqsUkn_nRQl5TA,6757
|
93
92
|
plain/models/migrations/graph.py,sha256=nrztu_8dU0wAUSxKUqqFWpvZcSQxGEqE6dXWkPytmCU,12570
|
@@ -95,28 +94,28 @@ plain/models/migrations/loader.py,sha256=qUTmaEYI1_mV6goQPQYZKjSz8rMbE6G1wqvrAsm
|
|
95
94
|
plain/models/migrations/migration.py,sha256=22YwRHnaRnCkBpW5p7K89tAU6h4QSsG5yiq-o7W-cSI,6505
|
96
95
|
plain/models/migrations/optimizer.py,sha256=HH-uz-jnWw_Ni6F2_rRW1nax1Dxmf1s_F_8s8N2OlVc,3266
|
97
96
|
plain/models/migrations/questioner.py,sha256=qAsePI5JHiSJrlY_kmpgMuK9Dom22q17edov7RtBeGw,11967
|
98
|
-
plain/models/migrations/recorder.py,sha256=
|
99
|
-
plain/models/migrations/serializer.py,sha256=
|
100
|
-
plain/models/migrations/state.py,sha256=
|
97
|
+
plain/models/migrations/recorder.py,sha256=_ncIVLJ4ns6AaO0vVmCoXfABlOFXDKu8NTPsutqKjK4,3653
|
98
|
+
plain/models/migrations/serializer.py,sha256=yBP9TyUZlSh_8qdw1I4VotbsZqoomz3mBs7ASQLsDH8,12459
|
99
|
+
plain/models/migrations/state.py,sha256=Q70cByjFgb8UG-wWqnLntf5s0hNv5DuDv0Bw1ovJ0yg,32116
|
101
100
|
plain/models/migrations/utils.py,sha256=Ih_mu6UbdUSt-ZtHaB0xIXHDrBANuFZyftTQ56BFJYs,4174
|
102
101
|
plain/models/migrations/writer.py,sha256=N8Rnjv5ccsA_CTcS7zZyppzyHFOUQVJy0l6RZYjwF-0,10981
|
103
|
-
plain/models/migrations/operations/__init__.py,sha256=
|
102
|
+
plain/models/migrations/operations/__init__.py,sha256=YKZsQsJ4G5iw9F4o6dOSgSCuLiiKuApvneoV4jqjZaA,752
|
104
103
|
plain/models/migrations/operations/base.py,sha256=JsKGjM6ouvEbFHzV14km7YjkpOUC4PoUR1M2yGZ82bE,4323
|
105
104
|
plain/models/migrations/operations/fields.py,sha256=ARL945rbztAnMsbd0lvQRsQJEmxYA3gDof0-4aOTeC4,11255
|
106
|
-
plain/models/migrations/operations/models.py,sha256=
|
107
|
-
plain/models/migrations/operations/special.py,sha256=
|
105
|
+
plain/models/migrations/operations/models.py,sha256=jwhck8ygfi8cW8baVeGUB6coVVv4HnGVSFVb2IW_aTU,24947
|
106
|
+
plain/models/migrations/operations/special.py,sha256=cKieE9AQcFrpvEw5_TJCum56uu6cfN1p-azY7sKdB7E,4944
|
108
107
|
plain/models/sql/__init__.py,sha256=FoRCcab-kh_XY8C4eldgLy9-zuk-M63Nyi9cFsYjclU,225
|
109
|
-
plain/models/sql/compiler.py,sha256=
|
108
|
+
plain/models/sql/compiler.py,sha256=FVa_v4Q8izuFc9VQTrW4jAqM1uqRnTVdOeP7IKt3yM8,84691
|
110
109
|
plain/models/sql/constants.py,sha256=usb1LSh9WNGPsurWAGppDkV0wYJJg5GEegKibQdS718,533
|
111
110
|
plain/models/sql/datastructures.py,sha256=FC88CVCukLyU621JrmKLBhmgvotEHgAhIOYfVvJpuR0,7084
|
112
|
-
plain/models/sql/query.py,sha256=
|
111
|
+
plain/models/sql/query.py,sha256=ASR6jeRTjGlnO5E_hb5cnUYQH2_JrpHa_M545xOG7dg,108745
|
113
112
|
plain/models/sql/subqueries.py,sha256=1YYlgoDrx_mW19MWWawLdgDTJnLgvvkGBQ30YQ702W4,5860
|
114
113
|
plain/models/sql/where.py,sha256=ezE9Clt2BmKo-I7ARsgqZ_aVA-1UdayCwr6ULSWZL6c,12635
|
115
114
|
plain/models/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
116
115
|
plain/models/test/pytest.py,sha256=KD5-mxonBxOYIhUh9Ql5uJOIiC9R4t-LYfb6sjA0UdE,3486
|
117
116
|
plain/models/test/utils.py,sha256=S3d6zf3OFWDxB_kBJr0tDvwn51bjwDVWKPumv37N-p8,467
|
118
|
-
plain_models-0.
|
119
|
-
plain_models-0.
|
120
|
-
plain_models-0.
|
121
|
-
plain_models-0.
|
122
|
-
plain_models-0.
|
117
|
+
plain_models-0.42.0.dist-info/METADATA,sha256=va18IrBAyfRfyJ42wY5tODp2SziPdmAxJN_G9_mEt6E,8884
|
118
|
+
plain_models-0.42.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
119
|
+
plain_models-0.42.0.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
|
120
|
+
plain_models-0.42.0.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
|
121
|
+
plain_models-0.42.0.dist-info/RECORD,,
|
plain/models/manager.py
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
import inspect
|
2
|
-
from functools import wraps
|
3
|
-
from importlib import import_module
|
4
|
-
|
5
|
-
from plain.models.query import QuerySet
|
6
|
-
|
7
|
-
|
8
|
-
class BaseManager:
|
9
|
-
# To retain order, track each time a Manager instance is created.
|
10
|
-
creation_counter = 0
|
11
|
-
|
12
|
-
# Set to True for the 'objects' managers that are automatically created.
|
13
|
-
auto_created = False
|
14
|
-
|
15
|
-
#: If set to True the manager will be serialized into migrations and will
|
16
|
-
#: thus be available in e.g. RunPython operations.
|
17
|
-
use_in_migrations = False
|
18
|
-
|
19
|
-
def __new__(cls, *args, **kwargs):
|
20
|
-
# Capture the arguments to make returning them trivial.
|
21
|
-
obj = super().__new__(cls)
|
22
|
-
obj._constructor_args = (args, kwargs)
|
23
|
-
return obj
|
24
|
-
|
25
|
-
def __init__(self):
|
26
|
-
super().__init__()
|
27
|
-
self._set_creation_counter()
|
28
|
-
self.model = None
|
29
|
-
self.name = None
|
30
|
-
self._hints = {}
|
31
|
-
|
32
|
-
def __str__(self):
|
33
|
-
"""Return "package_label.model_label.manager_name"."""
|
34
|
-
return f"{self.model._meta.label}.{self.name}"
|
35
|
-
|
36
|
-
def __class_getitem__(cls, *args, **kwargs):
|
37
|
-
return cls
|
38
|
-
|
39
|
-
def deconstruct(self):
|
40
|
-
"""
|
41
|
-
Return a 5-tuple of the form (as_manager (True), manager_class,
|
42
|
-
queryset_class, args, kwargs).
|
43
|
-
|
44
|
-
Raise a ValueError if the manager is dynamically generated.
|
45
|
-
"""
|
46
|
-
qs_class = self._queryset_class
|
47
|
-
if getattr(self, "_built_with_as_manager", False):
|
48
|
-
# using MyQuerySet.as_manager()
|
49
|
-
return (
|
50
|
-
True, # as_manager
|
51
|
-
None, # manager_class
|
52
|
-
f"{qs_class.__module__}.{qs_class.__name__}", # qs_class
|
53
|
-
None, # args
|
54
|
-
None, # kwargs
|
55
|
-
)
|
56
|
-
else:
|
57
|
-
module_name = self.__module__
|
58
|
-
name = self.__class__.__name__
|
59
|
-
# Make sure it's actually there and not an inner class
|
60
|
-
module = import_module(module_name)
|
61
|
-
if not hasattr(module, name):
|
62
|
-
raise ValueError(
|
63
|
-
f"Could not find manager {name} in {module_name}.\n"
|
64
|
-
"Please note that you need to inherit from managers you "
|
65
|
-
"dynamically generated with 'from_queryset()'."
|
66
|
-
)
|
67
|
-
return (
|
68
|
-
False, # as_manager
|
69
|
-
f"{module_name}.{name}", # manager_class
|
70
|
-
None, # qs_class
|
71
|
-
self._constructor_args[0], # args
|
72
|
-
self._constructor_args[1], # kwargs
|
73
|
-
)
|
74
|
-
|
75
|
-
def check(self, **kwargs):
|
76
|
-
return []
|
77
|
-
|
78
|
-
@classmethod
|
79
|
-
def _get_queryset_methods(cls, queryset_class):
|
80
|
-
def create_method(name, method):
|
81
|
-
@wraps(method)
|
82
|
-
def manager_method(self, *args, **kwargs):
|
83
|
-
return getattr(self.get_queryset(), name)(*args, **kwargs)
|
84
|
-
|
85
|
-
return manager_method
|
86
|
-
|
87
|
-
new_methods = {}
|
88
|
-
for name, method in inspect.getmembers(
|
89
|
-
queryset_class, predicate=inspect.isfunction
|
90
|
-
):
|
91
|
-
# Only copy missing methods.
|
92
|
-
if hasattr(cls, name):
|
93
|
-
continue
|
94
|
-
# Only copy public methods or methods with the attribute
|
95
|
-
# queryset_only=False.
|
96
|
-
queryset_only = getattr(method, "queryset_only", None)
|
97
|
-
if queryset_only or (queryset_only is None and name.startswith("_")):
|
98
|
-
continue
|
99
|
-
# Copy the method onto the manager.
|
100
|
-
new_methods[name] = create_method(name, method)
|
101
|
-
return new_methods
|
102
|
-
|
103
|
-
@classmethod
|
104
|
-
def from_queryset(cls, queryset_class, class_name=None):
|
105
|
-
if class_name is None:
|
106
|
-
class_name = f"{cls.__name__}From{queryset_class.__name__}"
|
107
|
-
return type(
|
108
|
-
class_name,
|
109
|
-
(cls,),
|
110
|
-
{
|
111
|
-
"_queryset_class": queryset_class,
|
112
|
-
**cls._get_queryset_methods(queryset_class),
|
113
|
-
},
|
114
|
-
)
|
115
|
-
|
116
|
-
def contribute_to_class(self, cls, name):
|
117
|
-
self.name = self.name or name
|
118
|
-
self.model = cls
|
119
|
-
|
120
|
-
setattr(cls, name, ManagerDescriptor(self))
|
121
|
-
|
122
|
-
cls._meta.add_manager(self)
|
123
|
-
|
124
|
-
def _set_creation_counter(self):
|
125
|
-
"""
|
126
|
-
Set the creation counter value for this instance and increment the
|
127
|
-
class-level copy.
|
128
|
-
"""
|
129
|
-
self.creation_counter = BaseManager.creation_counter
|
130
|
-
BaseManager.creation_counter += 1
|
131
|
-
|
132
|
-
#######################
|
133
|
-
# PROXIES TO QUERYSET #
|
134
|
-
#######################
|
135
|
-
|
136
|
-
def get_queryset(self):
|
137
|
-
"""
|
138
|
-
Return a new QuerySet object. Subclasses can override this method to
|
139
|
-
customize the behavior of the Manager.
|
140
|
-
"""
|
141
|
-
return self._queryset_class(model=self.model, hints=self._hints)
|
142
|
-
|
143
|
-
def all(self):
|
144
|
-
# We can't proxy this method through the `QuerySet` like we do for the
|
145
|
-
# rest of the `QuerySet` methods. This is because `QuerySet.all()`
|
146
|
-
# works by creating a "copy" of the current queryset and in making said
|
147
|
-
# copy, all the cached `prefetch_related` lookups are lost. See the
|
148
|
-
# implementation of `RelatedManager.get_queryset()` for a better
|
149
|
-
# understanding of how this comes into play.
|
150
|
-
return self.get_queryset()
|
151
|
-
|
152
|
-
def __eq__(self, other):
|
153
|
-
return (
|
154
|
-
isinstance(other, self.__class__)
|
155
|
-
and self._constructor_args == other._constructor_args
|
156
|
-
)
|
157
|
-
|
158
|
-
def __hash__(self):
|
159
|
-
return id(self)
|
160
|
-
|
161
|
-
|
162
|
-
class Manager(BaseManager.from_queryset(QuerySet)):
|
163
|
-
pass
|
164
|
-
|
165
|
-
|
166
|
-
class ManagerDescriptor:
|
167
|
-
def __init__(self, manager):
|
168
|
-
self.manager = manager
|
169
|
-
|
170
|
-
def __get__(self, instance, cls=None):
|
171
|
-
if instance is not None:
|
172
|
-
raise AttributeError(
|
173
|
-
f"Manager isn't accessible via {cls.__name__} instances"
|
174
|
-
)
|
175
|
-
|
176
|
-
return cls._meta.managers_map[self.manager.name]
|
File without changes
|
File without changes
|
File without changes
|