xn-model 1.0.17__tar.gz → 1.0.19__tar.gz
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.
- {xn_model-1.0.17/xn_model.egg-info → xn_model-1.0.19}/PKG-INFO +1 -1
- {xn_model-1.0.17 → xn_model-1.0.19}/x_model/models.py +4 -2
- {xn_model-1.0.17 → xn_model-1.0.19/xn_model.egg-info}/PKG-INFO +1 -1
- {xn_model-1.0.17 → xn_model-1.0.19}/.env.sample +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/.gitignore +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/.pre-commit-config.yaml +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/README.md +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/makefile +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/pyproject.toml +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/setup.cfg +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/tests/__init__.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/tests/test_db.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/x_model/__init__.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/x_model/field.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/x_model/func.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/x_model/types.py +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/xn_model.egg-info/SOURCES.txt +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/xn_model.egg-info/dependency_links.txt +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/xn_model.egg-info/requires.txt +0 -0
- {xn_model-1.0.17 → xn_model-1.0.19}/xn_model.egg-info/top_level.txt +0 -0
|
@@ -5,6 +5,7 @@ from typing import Self
|
|
|
5
5
|
from pydantic import ConfigDict
|
|
6
6
|
from tortoise import Model as TortModel
|
|
7
7
|
from tortoise.fields import IntField
|
|
8
|
+
from tortoise.signals import Signals
|
|
8
9
|
|
|
9
10
|
from x_model.field import DatetimeSecField
|
|
10
11
|
from x_model.types import BaseUpd
|
|
@@ -50,9 +51,10 @@ class Model(TortModel):
|
|
|
50
51
|
# if f.default or f.allows_generated or f.null or not f.required:
|
|
51
52
|
# fld += (field(default=f.default),)
|
|
52
53
|
# fields.append(fld)
|
|
53
|
-
|
|
54
|
+
pre_saves = [f.__name__ for f in cls._listeners[Signals.pre_save].get(cls, [])]
|
|
54
55
|
dcl = make_dataclass(cls.__name__ + cn, fields, bases=(BaseUpd,), kw_only=True)
|
|
55
|
-
dcl._unq =
|
|
56
|
+
dcl._unq = {o + "_id" for o in cls._meta.o2o_fields if o not in pre_saves}
|
|
57
|
+
dcl._unq |= set((cls._meta.unique_together or ((),))[0])
|
|
56
58
|
if with_pk:
|
|
57
59
|
dcl._unq |= {"id"}
|
|
58
60
|
setattr(cls, cn, dcl)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|