postgresdb3 2.0.0__tar.gz → 2.0.2__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.
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/PKG-INFO +1 -1
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/models.py +8 -4
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/query.py +13 -12
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3.egg-info/PKG-INFO +1 -1
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/setup.py +1 -1
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/README.md +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/__init__.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/cli.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/core/__init__.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/core/async_db.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/core/sync_db.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/migrations/__init__.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/migrations/engine.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/__init__.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/base.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/expressions.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/__init__.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/base.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/datetime.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/foreign.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/misc.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/numeric.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/fields/text.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/meta.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3/orm/relations.py +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3.egg-info/SOURCES.txt +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3.egg-info/dependency_links.txt +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3.egg-info/requires.txt +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/postgresdb3.egg-info/top_level.txt +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/pyproject.toml +0 -0
- {postgresdb3-2.0.0 → postgresdb3-2.0.2}/setup.cfg +0 -0
|
@@ -240,8 +240,10 @@ class Model(BaseModel, metaclass=ModelMeta):
|
|
|
240
240
|
if key == pk_name:
|
|
241
241
|
raise ValueError(f"{pk_name} ustunini yangilab bo'lmaydi")
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
if not isinstance(value, __import__("postgresdb3.orm.expressions", fromlist=["FExpression"]).FExpression):
|
|
244
|
+
setattr(self, key, value)
|
|
245
|
+
|
|
246
|
+
self.__class__.db.update_fields(self.__class__.table, kwargs, pk_name, pk_value)
|
|
245
247
|
|
|
246
248
|
return self
|
|
247
249
|
|
|
@@ -497,8 +499,10 @@ class AsyncModel(BaseModel, metaclass=ModelMeta):
|
|
|
497
499
|
if key == pk_name:
|
|
498
500
|
raise ValueError(f"{pk_name} ustunini yangilab bo'lmaydi")
|
|
499
501
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
+
if not isinstance(value, __import__("postgresdb3.orm.expressions", fromlist=["FExpression"]).FExpression):
|
|
503
|
+
setattr(self, key, value)
|
|
504
|
+
|
|
505
|
+
await self.__class__.db.update_fields(self.__class__.table, kwargs, pk_name, pk_value)
|
|
502
506
|
|
|
503
507
|
return self
|
|
504
508
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import TypeVar, Generic
|
|
3
|
+
from postgresdb3.orm.expressions import Q
|
|
3
4
|
|
|
4
5
|
T = TypeVar('T')
|
|
5
6
|
|
|
@@ -27,8 +28,8 @@ class QuerySet:
|
|
|
27
28
|
|
|
28
29
|
def _clone(self):
|
|
29
30
|
qs = self.__class__(self.model)
|
|
30
|
-
qs._where =
|
|
31
|
-
qs._exclude =
|
|
31
|
+
qs._where = list(self._where) if self._where else None
|
|
32
|
+
qs._exclude = list(self._exclude) if self._exclude else None
|
|
32
33
|
qs._order_by = self._order_by
|
|
33
34
|
qs._limit = self._limit
|
|
34
35
|
qs._offset = self._offset
|
|
@@ -409,15 +410,15 @@ class QuerySet:
|
|
|
409
410
|
if not kwargs:
|
|
410
411
|
return 0
|
|
411
412
|
where = self._build_where()
|
|
412
|
-
if not where:
|
|
413
|
+
if not where or (isinstance(where, Q) and not where.conditions and not where.children):
|
|
413
414
|
raise ValueError("Ommaviy update uchun filter berish shart! (Barcha qatorlarni o'zgartirishdan himoya)")
|
|
414
|
-
return self.model.db.update_where(self.model.table, kwargs, where=
|
|
415
|
+
return self.model.db.update_where(self.model.table, kwargs, where=where)
|
|
415
416
|
|
|
416
417
|
def delete(self):
|
|
417
418
|
where = self._build_where()
|
|
418
|
-
if not where:
|
|
419
|
+
if not where or (isinstance(where, Q) and not where.conditions and not where.children):
|
|
419
420
|
raise ValueError("Ommaviy delete uchun filter berish shart! (Barcha qatorlarni o'chirishdan himoya)")
|
|
420
|
-
return self.model.db.delete_where(self.model.table, where=
|
|
421
|
+
return self.model.db.delete_where(self.model.table, where=where)
|
|
421
422
|
|
|
422
423
|
def count(self):
|
|
423
424
|
where = self._build_where()
|
|
@@ -512,8 +513,8 @@ class AsyncQuerySet:
|
|
|
512
513
|
|
|
513
514
|
def _clone(self):
|
|
514
515
|
qs = self.__class__(self.model)
|
|
515
|
-
qs._where =
|
|
516
|
-
qs._exclude =
|
|
516
|
+
qs._where = list(self._where) if self._where else None
|
|
517
|
+
qs._exclude = list(self._exclude) if self._exclude else None
|
|
517
518
|
qs._order_by = self._order_by
|
|
518
519
|
qs._limit = self._limit
|
|
519
520
|
qs._offset = self._offset
|
|
@@ -869,15 +870,15 @@ class AsyncQuerySet:
|
|
|
869
870
|
if not kwargs:
|
|
870
871
|
return 0
|
|
871
872
|
where = self._build_where()
|
|
872
|
-
if not where:
|
|
873
|
+
if not where or (isinstance(where, Q) and not where.conditions and not where.children):
|
|
873
874
|
raise ValueError("Ommaviy update uchun filter berish shart! (Barcha qatorlarni o'zgartirishdan himoya)")
|
|
874
|
-
return await self.model.db.update_where(self.model.table, kwargs, where=
|
|
875
|
+
return await self.model.db.update_where(self.model.table, kwargs, where=where)
|
|
875
876
|
|
|
876
877
|
async def delete(self):
|
|
877
878
|
where = self._build_where()
|
|
878
|
-
if not where:
|
|
879
|
+
if not where or (isinstance(where, Q) and not where.conditions and not where.children):
|
|
879
880
|
raise ValueError("Ommaviy delete uchun filter berish shart! (Barcha qatorlarni o'chirishdan himoya)")
|
|
880
|
-
return await self.model.db.delete_where(self.model.table, where=
|
|
881
|
+
return await self.model.db.delete_where(self.model.table, where=where)
|
|
881
882
|
|
|
882
883
|
async def last(self):
|
|
883
884
|
pk_name = self.model.get_pk_name()
|
|
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
|
|
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
|