xn-model 1.0.14__py3-none-any.whl → 1.0.16__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.
- x_model/func.py +2 -2
- x_model/models.py +4 -4
- x_model/types.py +1 -1
- {xn_model-1.0.14.dist-info → xn_model-1.0.16.dist-info}/METADATA +1 -1
- xn_model-1.0.16.dist-info/RECORD +9 -0
- {xn_model-1.0.14.dist-info → xn_model-1.0.16.dist-info}/WHEEL +1 -1
- xn_model-1.0.14.dist-info/RECORD +0 -9
- {xn_model-1.0.14.dist-info → xn_model-1.0.16.dist-info}/top_level.txt +0 -0
x_model/func.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from
|
|
1
|
+
from pypika_tortoise.terms import AggregateFunction, Field
|
|
2
2
|
from tortoise.expressions import Function
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class ArrayAgg(AggregateFunction):
|
|
6
6
|
def __init__(self, term, alias=None):
|
|
7
|
-
super(ArrayAgg, self).__init__("array_agg", term, alias=alias)
|
|
7
|
+
super(ArrayAgg, self).__init__("array_agg", Field(term), alias=alias)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Array(Function):
|
x_model/models.py
CHANGED
|
@@ -52,17 +52,17 @@ class Model(TortModel):
|
|
|
52
52
|
# fields.append(fld)
|
|
53
53
|
|
|
54
54
|
dcl = make_dataclass(cls.__name__ + cn, fields, bases=(BaseUpd,), kw_only=True)
|
|
55
|
-
dcl._unq = (cls._meta.unique_together or ((),))[0]
|
|
55
|
+
dcl._unq = set((cls._meta.unique_together or ((),))[0])
|
|
56
56
|
if with_pk:
|
|
57
|
-
dcl._unq
|
|
57
|
+
dcl._unq |= {"id"}
|
|
58
58
|
setattr(cls, cn, dcl)
|
|
59
59
|
|
|
60
60
|
return getattr(cls, cn)
|
|
61
61
|
|
|
62
62
|
# # # CRUD Methods # # #
|
|
63
63
|
@classmethod
|
|
64
|
-
def validate(cls, dct: dict) -> BaseUpd:
|
|
65
|
-
dcl = cls.in_type("id" in dct)
|
|
64
|
+
def validate(cls, dct: dict, with_pk: bool = None) -> BaseUpd:
|
|
65
|
+
dcl = cls.in_type("id" in dct if with_pk is None else with_pk)
|
|
66
66
|
field_names = [n.name for n in fields(dcl)]
|
|
67
67
|
return dcl(**{k: v for k, v in dct.items() if k in field_names})
|
|
68
68
|
|
x_model/types.py
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
|
|
2
|
+
x_model/field.py,sha256=zVszcPZFVEwsurqbFQF-_caiSLruh3TRSZdgQqwWJV8,2776
|
|
3
|
+
x_model/func.py,sha256=flj89sCOou7NJlriPYbIpX8rdbugbe-vjT2C0ORl9DY,312
|
|
4
|
+
x_model/models.py,sha256=IMql5xfU1dw7n1uYba5pXQnsK7_1pzLTScGRWYUW2NA,3602
|
|
5
|
+
x_model/types.py,sha256=iES9Oxj45hEBB1tvZlNAOM4eS7w3Y8iC37X7FmcEwe4,318
|
|
6
|
+
xn_model-1.0.16.dist-info/METADATA,sha256=XD9qURCotfDXy2ry3iAFNYaqLSjQwiG28wzlrlj1v7U,986
|
|
7
|
+
xn_model-1.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
xn_model-1.0.16.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
+
xn_model-1.0.16.dist-info/RECORD,,
|
xn_model-1.0.14.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
|
|
2
|
-
x_model/field.py,sha256=zVszcPZFVEwsurqbFQF-_caiSLruh3TRSZdgQqwWJV8,2776
|
|
3
|
-
x_model/func.py,sha256=E7jDoHJGaFpKvxbHnT_lyBxUZeMo-GRd5gv9dLw7B9s,289
|
|
4
|
-
x_model/models.py,sha256=EmudSEdcxsydnj6OyqnA1xdAVPhxRUN79610ncLpPXw,3544
|
|
5
|
-
x_model/types.py,sha256=sF-j-IzL00as74pnQbjdDC82oKJlbpxzoAvbE7KDCHs,320
|
|
6
|
-
xn_model-1.0.14.dist-info/METADATA,sha256=2CXAIifJuvL-0QoVum0pZcYSXvWHg3HYyRZOMpQlDo8,986
|
|
7
|
-
xn_model-1.0.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
8
|
-
xn_model-1.0.14.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
-
xn_model-1.0.14.dist-info/RECORD,,
|
|
File without changes
|