plain.models 0.51.0__py3-none-any.whl → 0.51.1__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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # plain-models changelog
2
2
 
3
+ ## [0.51.1](https://github.com/dropseed/plain/releases/plain-models@0.51.1) (2025-10-08)
4
+
5
+ ### What's changed
6
+
7
+ - Fixed a bug in `Subquery` and `Exists` expressions that was using the old `query` attribute name instead of `sql_query` when extracting the SQL query from a QuerySet ([79ca52d](https://github.com/dropseed/plain/commit/79ca52d32e))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - No changes required
12
+
3
13
  ## [0.51.0](https://github.com/dropseed/plain/releases/plain-models@0.51.0) (2025-10-07)
4
14
 
5
15
  ### What's changed
@@ -28,7 +28,9 @@ if TYPE_CHECKING:
28
28
 
29
29
  from plain.models.backends.base.base import BaseDatabaseWrapper
30
30
  from plain.models.fields import Field
31
+ from plain.models.query import QuerySet
31
32
  from plain.models.sql.compiler import SQLCompiler
33
+ from plain.models.sql.query import Query
32
34
 
33
35
 
34
36
  class SQLiteNumericMixin:
@@ -1635,9 +1637,23 @@ class Subquery(BaseExpression, Combinable):
1635
1637
  contains_aggregate = False
1636
1638
  empty_result_set_value = None
1637
1639
 
1638
- def __init__(self, queryset: Any, output_field: Field | None = None, **extra: Any):
1640
+ def __init__(
1641
+ self,
1642
+ query: QuerySet[Any] | Query,
1643
+ output_field: Field | None = None,
1644
+ **extra: Any,
1645
+ ):
1646
+ # Import here to avoid circular import
1647
+ from plain.models.sql.query import Query
1648
+
1639
1649
  # Allow the usage of both QuerySet and sql.Query objects.
1640
- self.query = getattr(queryset, "query", queryset).clone()
1650
+ if isinstance(query, Query):
1651
+ # It's already a Query object, use it directly
1652
+ sql_query = query
1653
+ else:
1654
+ # It's a QuerySet, extract the sql.Query
1655
+ sql_query = query.sql_query
1656
+ self.query = sql_query.clone()
1641
1657
  self.query.subquery = True
1642
1658
  self.extra = extra
1643
1659
  super().__init__(output_field)
@@ -1688,8 +1704,8 @@ class Exists(Subquery):
1688
1704
  output_field = fields.BooleanField()
1689
1705
  empty_result_set_value = False
1690
1706
 
1691
- def __init__(self, queryset: Any, **kwargs: Any):
1692
- super().__init__(queryset, **kwargs)
1707
+ def __init__(self, query: QuerySet[Any] | Query, **kwargs: Any):
1708
+ super().__init__(query, **kwargs)
1693
1709
  self.query = self.query.exists()
1694
1710
 
1695
1711
  def select_format(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.models
3
- Version: 0.51.0
3
+ Version: 0.51.1
4
4
  Summary: Model your data and store it in a database.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-File: LICENSE
@@ -1,5 +1,5 @@
1
1
  plain/models/AGENTS.md,sha256=xQQW-z-DehnCUyjiGSBfLqUjoSUdo_W1b0JmwYmWieA,209
2
- plain/models/CHANGELOG.md,sha256=tRbJFhy_HIM9hVZm8zrVzAah7-rr-K5ZdjJ2Zj38bQk,22767
2
+ plain/models/CHANGELOG.md,sha256=Wr9ULasjvH3Shkr1jN75_KeNkRd_ZR8gCzR63-TWvps,23160
3
3
  plain/models/README.md,sha256=BW4a56bKkf2r-fkfK4SIU92th8h1geBNZ6j-XCv9yE4,8190
4
4
  plain/models/__init__.py,sha256=S0HNxIS4PQ0mSNpo3PNOXExVnHXFmODQvdPhTCVrW-E,2903
5
5
  plain/models/aggregates.py,sha256=z6AjlPlMI-henws9DYPwylL91sfrBPPHR7f9MNb2cjw,8043
@@ -16,7 +16,7 @@ plain/models/deletion.py,sha256=xQ1X_2W45h0L16R-8HAYceb0q4XhEidY6lCRPi8vvJ0,1908
16
16
  plain/models/entrypoints.py,sha256=8IyQlCia0c9ZZaWHOA9FrqmN0iG_z9EeFoqEZifsdH4,199
17
17
  plain/models/enums.py,sha256=IOqdywY_TNNJIDp-reaRlbTL-1uVw3jwQ4NpVT8yjDs,3049
18
18
  plain/models/exceptions.py,sha256=DOnRGvbEHEUDr3ioafhK1rSBnMeJ_Q4VW7gZXEIj7SU,5492
19
- plain/models/expressions.py,sha256=2loVMU0u3xyq_yFKR8po53rLopFmfAa01bmaVosLj0I,70765
19
+ plain/models/expressions.py,sha256=5Bf8V0wMMVzLueDEpTH5f_8skRspq6nNYi5y1S3fNAo,71223
20
20
  plain/models/forms.py,sha256=dkX3or5TROgKAzkLayek63pngYrcIYdijZQS0LcYhhI,27428
21
21
  plain/models/indexes.py,sha256=fiQ1F-zDVJPSSGb_zaH4Kj1H_dBkMpXM2znHWA2KLjk,12761
22
22
  plain/models/lookups.py,sha256=A-3rs3a2Obb-gQPs5RsQiCq-Shj21tznk2LwOeD4RXs,29447
@@ -116,8 +116,8 @@ plain/models/sql/where.py,sha256=GeTopzVmvZTqm2NTS32ok0rHbNgoEREUVtsD7usrlCA,138
116
116
  plain/models/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
117
  plain/models/test/pytest.py,sha256=sZtHzmNoqIFb7csZ8fqbRwljQ0vWrcMcDm6Wk_0g-uk,3924
118
118
  plain/models/test/utils.py,sha256=eduH039cMVixWORfsUr7qkk0YDkTHPXFZklm9lzY474,540
119
- plain_models-0.51.0.dist-info/METADATA,sha256=VMrUDpaJcQqjHDb-BrnbcVTJg6mPytoxxE6CsgEy4Ec,8502
120
- plain_models-0.51.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
121
- plain_models-0.51.0.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
122
- plain_models-0.51.0.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
123
- plain_models-0.51.0.dist-info/RECORD,,
119
+ plain_models-0.51.1.dist-info/METADATA,sha256=KnNRGQxkypz9IZdzymjZYxCqAeKAfnNJfI7bU886uRc,8502
120
+ plain_models-0.51.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
121
+ plain_models-0.51.1.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
122
+ plain_models-0.51.1.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
123
+ plain_models-0.51.1.dist-info/RECORD,,