plain.models 0.46.0__py3-none-any.whl → 0.46.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.46.1](https://github.com/dropseed/plain/releases/plain-models@0.46.1) (2025-09-25)
4
+
5
+ ### What's changed
6
+
7
+ - Fixed `prefetch_related` for reverse foreign key relationships by correctly handling related managers in the prefetch query process ([2c04e80](https://github.com/dropseed/plain/commit/2c04e80dcd))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - No changes required
12
+
3
13
  ## [0.46.0](https://github.com/dropseed/plain/releases/plain-models@0.46.0) (2025-09-25)
4
14
 
5
15
  ### What's changed
plain/models/query.py CHANGED
@@ -2204,7 +2204,15 @@ def prefetch_one_level(instances, prefetcher, lookup, level):
2204
2204
  if leaf and lookup.queryset is not None:
2205
2205
  qs = queryset._apply_rel_filters(lookup.queryset)
2206
2206
  else:
2207
- qs = queryset.__class__(model=queryset.model)
2207
+ # Check if queryset is a QuerySet or a related manager
2208
+ # We need a QuerySet instance to cache the prefetched values
2209
+ if isinstance(queryset, QuerySet):
2210
+ # It's already a QuerySet, create a new instance
2211
+ qs = queryset.__class__(model=queryset.model)
2212
+ else:
2213
+ # It's a related manager, get its QuerySet
2214
+ # The manager's query property returns a properly filtered QuerySet
2215
+ qs = queryset.query
2208
2216
  qs._result_cache = vals
2209
2217
  # We don't want the individual qs doing prefetch_related now,
2210
2218
  # since we have merged this into the current work.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.models
3
- Version: 0.46.0
3
+ Version: 0.46.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=sP6SfQbc4brCN0mgeyZvDQ2hEk9i2lGH49bKPJGOZlw,16770
2
+ plain/models/CHANGELOG.md,sha256=4voxndtCFoJPgNaMk6hb9-pmBS-pNOEvc8-zsgcPXXM,17129
3
3
  plain/models/README.md,sha256=lqzWJrEIxBCHC1P8X1YoRjbsMFlu0-kG4ujP76B_ZO4,8572
4
4
  plain/models/__init__.py,sha256=aB9HhIKBh0iK3LZztInAE-rDF-yKsdfcjfMtwtN5vnI,2920
5
5
  plain/models/aggregates.py,sha256=P0mhsMl1VZt2CVHMuCHnNI8SxZ9citjDLEgioN6NOpo,7240
@@ -23,7 +23,7 @@ plain/models/lookups.py,sha256=eCsxQXUcOoAa_U_fAAd3edcgXI1wfyFW8hPgUh8TwTo,24776
23
23
  plain/models/options.py,sha256=BOnu9NDVcgL0tJhan5gBbaK1SWNeg4NVTPNAzkKT3NE,21528
24
24
  plain/models/otel.py,sha256=36QSJS6UXv1YPJTqeSmEvdMVHRkXa_zgqqItJaXc59g,7619
25
25
  plain/models/preflight.py,sha256=_cBX7AnfQDNtZfoW0ydxH8WQM3ftCqcH0-tPhqS5q8c,8973
26
- plain/models/query.py,sha256=6t0ow7oQfVB6WiC3fQ3kLme8TBeSOscEt5xl2lu6oOQ,89703
26
+ plain/models/query.py,sha256=0Mzg-tczpxGQ383GI2HwV-wf7GMKl_ivhPedeY1MpNY,90220
27
27
  plain/models/query_utils.py,sha256=zxAdfwDbOmaN_SJODl4Wl9gs-q2EzOjXbsBFTWWhh8g,14174
28
28
  plain/models/registry.py,sha256=5yxVgT_W8GlyL2bsGT2HvMQB5sKolXucP2qrhr7Wlnk,8126
29
29
  plain/models/transaction.py,sha256=KqkRDT6aqMgbPA_ch7qO8a9NyDvwY_2FaxM7FkBkcgY,9357
@@ -115,8 +115,8 @@ plain/models/sql/where.py,sha256=ezE9Clt2BmKo-I7ARsgqZ_aVA-1UdayCwr6ULSWZL6c,126
115
115
  plain/models/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
116
  plain/models/test/pytest.py,sha256=KD5-mxonBxOYIhUh9Ql5uJOIiC9R4t-LYfb6sjA0UdE,3486
117
117
  plain/models/test/utils.py,sha256=S3d6zf3OFWDxB_kBJr0tDvwn51bjwDVWKPumv37N-p8,467
118
- plain_models-0.46.0.dist-info/METADATA,sha256=gcrk_0dq0Aae9LjlI_uB1g5XrjfuDFQ2bU7wbAgExn8,8884
119
- plain_models-0.46.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
120
- plain_models-0.46.0.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
121
- plain_models-0.46.0.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
122
- plain_models-0.46.0.dist-info/RECORD,,
118
+ plain_models-0.46.1.dist-info/METADATA,sha256=WuLQKMHTTBKeEP1zmLYoHbjVxxkIi3sKOgee-MewjrM,8884
119
+ plain_models-0.46.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
120
+ plain_models-0.46.1.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
121
+ plain_models-0.46.1.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
122
+ plain_models-0.46.1.dist-info/RECORD,,