piccolo 1.12.0__py3-none-any.whl → 1.13.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.
- piccolo/__init__.py +1 -1
- piccolo/columns/column_types.py +4 -7
- piccolo/columns/reference.py +3 -0
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/METADATA +1 -1
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/RECORD +10 -10
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/WHEEL +1 -1
- tests/columns/test_reference.py +34 -1
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/LICENSE +0 -0
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/entry_points.txt +0 -0
- {piccolo-1.12.0.dist-info → piccolo-1.13.0.dist-info}/top_level.txt +0 -0
piccolo/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__VERSION__ = "1.
|
1
|
+
__VERSION__ = "1.13.0"
|
piccolo/columns/column_types.py
CHANGED
@@ -363,7 +363,7 @@ class Email(Varchar):
|
|
363
363
|
Used for storing email addresses. It's identical to :class:`Varchar`,
|
364
364
|
except when using :func:`create_pydantic_model <piccolo.utils.pydantic.create_pydantic_model>` -
|
365
365
|
we add email validation to the Pydantic model. This means that :ref:`PiccoloAdmin`
|
366
|
-
also validates
|
366
|
+
also validates email addresses.
|
367
367
|
""" # noqa: E501
|
368
368
|
|
369
369
|
pass
|
@@ -2183,7 +2183,7 @@ class ForeignKey(Column, t.Generic[ReferencedTable]):
|
|
2183
2183
|
# If the ForeignKey is using a lazy reference, we need to set the
|
2184
2184
|
# attributes here. Attributes starting with an underscore are
|
2185
2185
|
# unlikely to be column names.
|
2186
|
-
if not name.startswith("
|
2186
|
+
if not name.startswith("_") and name not in dir(self):
|
2187
2187
|
try:
|
2188
2188
|
_foreign_key_meta = object.__getattribute__(
|
2189
2189
|
self, "_foreign_key_meta"
|
@@ -2196,12 +2196,9 @@ class ForeignKey(Column, t.Generic[ReferencedTable]):
|
|
2196
2196
|
):
|
2197
2197
|
object.__getattribute__(self, "set_proxy_columns")()
|
2198
2198
|
|
2199
|
-
|
2200
|
-
value = object.__getattribute__(self, name)
|
2201
|
-
except AttributeError:
|
2202
|
-
raise AttributeError
|
2199
|
+
value = object.__getattribute__(self, name)
|
2203
2200
|
|
2204
|
-
if name
|
2201
|
+
if name.startswith("_"):
|
2205
2202
|
return value
|
2206
2203
|
|
2207
2204
|
foreignkey_class: t.Type[ForeignKey] = object.__getattribute__(
|
piccolo/columns/reference.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
piccolo/__init__.py,sha256=
|
1
|
+
piccolo/__init__.py,sha256=_pdR4g2JWRC1g3rk3ruzcIk6hErZuJmLbmZNFfQFp2g,23
|
2
2
|
piccolo/custom_types.py,sha256=7HMQAze-5mieNLfbQ5QgbRQgR2abR7ol0qehv2SqROY,604
|
3
3
|
piccolo/main.py,sha256=1VsFV67FWTUikPTysp64Fmgd9QBVa_9wcwKfwj2UCEA,5117
|
4
4
|
piccolo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -117,12 +117,12 @@ piccolo/apps/user/piccolo_migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
117
117
|
piccolo/columns/__init__.py,sha256=OYhO_n9anMiU9nL-K6ATq9FhAtm8RyMpqYQ7fTVbhxI,1120
|
118
118
|
piccolo/columns/base.py,sha256=sgMiBvq-xLW6_W86g6XZTMc_3cskyeoMF6yIvIlnXsA,32487
|
119
119
|
piccolo/columns/choices.py,sha256=-HNQuk9vMmVZIPZ5PMeXGTfr23o4nzKPSAkvcG1k0y8,723
|
120
|
-
piccolo/columns/column_types.py,sha256=
|
120
|
+
piccolo/columns/column_types.py,sha256=X_ZsA0C4WBNVonV2OsizRdt1osMshgtQ3Ob6JN-amfg,83485
|
121
121
|
piccolo/columns/combination.py,sha256=vMXC2dfY7pvnCFhsT71XFVyb4gdQzfRsCMaiduu04Ss,6900
|
122
122
|
piccolo/columns/indexes.py,sha256=NfNok3v_791jgDlN28KmhP9ZCjl6031BXmjxV3ovXJk,372
|
123
123
|
piccolo/columns/m2m.py,sha256=17NY0wU7ta2rUTHYUkeA2HQhTDlJ_lyv9FxqvJiiUbY,14602
|
124
124
|
piccolo/columns/readable.py,sha256=hganxUPfIK5ZXn-qgteBxsOJfBJucgr9U0QLsLFYcuI,1562
|
125
|
-
piccolo/columns/reference.py,sha256=
|
125
|
+
piccolo/columns/reference.py,sha256=n4SW5CGrUSwsRk2Pm7UbikmKdUHuJ2D5OobQ7Mea1vQ,3669
|
126
126
|
piccolo/columns/defaults/__init__.py,sha256=7hpB13baEJgc1zbZjRKDFr-5hltxM2VGj8KnKfOiS8c,145
|
127
127
|
piccolo/columns/defaults/base.py,sha256=z_ZgtSFbLuwqdYdI7dr2n1SeyTJ7M4Ee4Ki7eRaBlVA,1869
|
128
128
|
piccolo/columns/defaults/date.py,sha256=Duuyi-QJ9Rr72aJkCNnjyO1CJBE-inZNGKnyV8tbLLE,2517
|
@@ -263,7 +263,7 @@ tests/columns/test_numeric.py,sha256=WrilQrWc-_g8DGLUvmllSBL01xqYqDORt3ypplnRizA
|
|
263
263
|
tests/columns/test_primary_key.py,sha256=hXnTF-kFgrFNjawvJstmR3YQCM59qJ4NWkMD9vRY8FI,4871
|
264
264
|
tests/columns/test_readable.py,sha256=OFK2n_k-eqRLdjEg1X2aOFPNwhtGDPNBli4DAh3i6vw,743
|
265
265
|
tests/columns/test_real.py,sha256=bSjACkbnJzrN9dEWVb0UdWqSDfxdGz5HMWc8PUsJUl4,496
|
266
|
-
tests/columns/test_reference.py,sha256=
|
266
|
+
tests/columns/test_reference.py,sha256=d7vm7AHinISA-HjlA8zyPCRaAGPtnc5NOXUvK4SeQFg,2329
|
267
267
|
tests/columns/test_reserved_column_names.py,sha256=BpqN49n_AaiPjaaJ43hLhFXQHb8NV6ig8nvgKvN0Smc,1404
|
268
268
|
tests/columns/test_smallint.py,sha256=t-LNX7XXy-k5_lhGXwELyC0LB9Iq4WrBVQdvEYf5EaQ,984
|
269
269
|
tests/columns/test_time.py,sha256=qyG4jjSO_B2DfkjQo3nIff2T201c75EI7M6CYspK5QM,1560
|
@@ -365,9 +365,9 @@ tests/utils/test_sql_values.py,sha256=vzxRmy16FfLZPH-sAQexBvsF9MXB8n4smr14qoEOS5
|
|
365
365
|
tests/utils/test_sync.py,sha256=9ytVo56y2vPQePvTeIi9lHIouEhWJbodl1TmzkGFrSo,799
|
366
366
|
tests/utils/test_table_reflection.py,sha256=SIzuat-IpcVj1GCFyOWKShI8YkhdOPPFH7qVrvfyPNE,3794
|
367
367
|
tests/utils/test_warnings.py,sha256=NvSC_cvJ6uZcwAGf1m-hLzETXCqprXELL8zg3TNLVMw,269
|
368
|
-
piccolo-1.
|
369
|
-
piccolo-1.
|
370
|
-
piccolo-1.
|
371
|
-
piccolo-1.
|
372
|
-
piccolo-1.
|
373
|
-
piccolo-1.
|
368
|
+
piccolo-1.13.0.dist-info/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
|
369
|
+
piccolo-1.13.0.dist-info/METADATA,sha256=_91g-EFcPz7HM3RBSgIfTtyRehV0IfI-vXRZ12XqJ1I,5150
|
370
|
+
piccolo-1.13.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
371
|
+
piccolo-1.13.0.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
|
372
|
+
piccolo-1.13.0.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
|
373
|
+
piccolo-1.13.0.dist-info/RECORD,,
|
tests/columns/test_reference.py
CHANGED
@@ -5,10 +5,41 @@ piccolo/columns/test_foreignkey.py
|
|
5
5
|
|
6
6
|
from unittest import TestCase
|
7
7
|
|
8
|
+
from piccolo.columns import ForeignKey, Varchar
|
8
9
|
from piccolo.columns.reference import LazyTableReference
|
10
|
+
from piccolo.table import Table
|
11
|
+
from tests.base import TableTest
|
9
12
|
|
10
13
|
|
11
|
-
class
|
14
|
+
class Band(Table):
|
15
|
+
manager: ForeignKey["Manager"] = ForeignKey(
|
16
|
+
LazyTableReference("Manager", module_path=__name__)
|
17
|
+
)
|
18
|
+
name = Varchar()
|
19
|
+
|
20
|
+
|
21
|
+
class Manager(Table):
|
22
|
+
name = Varchar()
|
23
|
+
|
24
|
+
|
25
|
+
class TestQueries(TableTest):
|
26
|
+
tables = [Band, Manager]
|
27
|
+
|
28
|
+
def setUp(self):
|
29
|
+
super().setUp()
|
30
|
+
manager = Manager({Manager.name: "Guido"})
|
31
|
+
manager.save().run_sync()
|
32
|
+
band = Band({Band.name: "Pythonistas", Band.manager: manager})
|
33
|
+
band.save().run_sync()
|
34
|
+
|
35
|
+
def test_select(self):
|
36
|
+
self.assertListEqual(
|
37
|
+
Band.select(Band.name, Band.manager._.name).run_sync(),
|
38
|
+
[{"name": "Pythonistas", "manager.name": "Guido"}],
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
class TestInit(TestCase):
|
12
43
|
def test_init(self):
|
13
44
|
"""
|
14
45
|
A ``LazyTableReference`` must be passed either an ``app_name`` or
|
@@ -34,6 +65,8 @@ class TestLazyTableReference(TestCase):
|
|
34
65
|
module_path="tests.example_apps.music.tables",
|
35
66
|
)
|
36
67
|
|
68
|
+
|
69
|
+
class TestStr(TestCase):
|
37
70
|
def test_str(self):
|
38
71
|
self.assertEqual(
|
39
72
|
LazyTableReference(
|
File without changes
|
File without changes
|
File without changes
|