statezero 0.1.0b13__tar.gz → 0.1.0b15__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.

Potentially problematic release.


This version of statezero might be problematic. Click here for more details.

Files changed (54) hide show
  1. {statezero-0.1.0b13 → statezero-0.1.0b15}/PKG-INFO +1 -1
  2. {statezero-0.1.0b13 → statezero-0.1.0b15}/pyproject.toml +1 -1
  3. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/schemas.py +13 -2
  4. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/ast_parser.py +13 -2
  5. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/config.py +2 -0
  6. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero.egg-info/PKG-INFO +1 -1
  7. {statezero-0.1.0b13 → statezero-0.1.0b15}/README.md +0 -0
  8. {statezero-0.1.0b13 → statezero-0.1.0b15}/license.md +0 -0
  9. {statezero-0.1.0b13 → statezero-0.1.0b15}/requirements.txt +0 -0
  10. {statezero-0.1.0b13 → statezero-0.1.0b15}/setup.cfg +0 -0
  11. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/__init__.py +0 -0
  12. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/__init__.py +0 -0
  13. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/__init__.py +0 -0
  14. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/actions.py +0 -0
  15. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/apps.py +0 -0
  16. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/config.py +0 -0
  17. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/context_manager.py +0 -0
  18. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/event_emitters.py +0 -0
  19. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/exception_handler.py +0 -0
  20. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/extensions/__init__.py +0 -0
  21. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/extensions/custom_field_serializers/__init__.py +0 -0
  22. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/extensions/custom_field_serializers/file_fields.py +0 -0
  23. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/extensions/custom_field_serializers/money_field.py +0 -0
  24. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/f_handler.py +0 -0
  25. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/helpers.py +0 -0
  26. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/middleware.py +0 -0
  27. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/migrations/0001_initial.py +0 -0
  28. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/migrations/0002_delete_modelviewsubscription.py +0 -0
  29. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/migrations/__init__.py +0 -0
  30. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/orm.py +0 -0
  31. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/permissions.py +0 -0
  32. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/query_optimizer.py +0 -0
  33. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/search_providers/__init__.py +0 -0
  34. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/search_providers/basic_search.py +0 -0
  35. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/search_providers/postgres_search.py +0 -0
  36. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/serializers.py +0 -0
  37. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/urls.py +0 -0
  38. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/adaptors/django/views.py +0 -0
  39. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/__init__.py +0 -0
  40. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/actions.py +0 -0
  41. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/ast_validator.py +0 -0
  42. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/classes.py +0 -0
  43. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/context_storage.py +0 -0
  44. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/event_bus.py +0 -0
  45. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/event_emitters.py +0 -0
  46. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/exceptions.py +0 -0
  47. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/hook_checks.py +0 -0
  48. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/interfaces.py +0 -0
  49. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/process_request.py +0 -0
  50. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero/core/types.py +0 -0
  51. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero.egg-info/SOURCES.txt +0 -0
  52. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero.egg-info/dependency_links.txt +0 -0
  53. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero.egg-info/requires.txt +0 -0
  54. {statezero-0.1.0b13 → statezero-0.1.0b15}/statezero.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statezero
3
- Version: 0.1.0b13
3
+ Version: 0.1.0b15
4
4
  Summary: Connect your Python backend to a modern JavaScript SPA frontend with 90% less complexity.
5
5
  Author-email: Robert <robert.herring@statezero.dev>
6
6
  Project-URL: homepage, https://www.statezero.dev
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "statezero"
7
- version = "0.1.0b13"
7
+ version = "0.1.0b15"
8
8
  description = "Connect your Python backend to a modern JavaScript SPA frontend with 90% less complexity."
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -41,9 +41,9 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
41
41
  all_field_names: Set[str] = set()
42
42
  db_field_names: Set[str] = set()
43
43
 
44
- if model_config.fields != "__all__":
44
+ if model_config.frontend_fields != "__all__":
45
45
  all_fields = [
46
- field for field in all_fields if field.name in model_config.fields
46
+ field for field in all_fields if field.name in model_config.frontend_fields
47
47
  ]
48
48
 
49
49
  for field in all_fields:
@@ -178,6 +178,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
178
178
  nullable=False,
179
179
  format=FieldFormat.ID,
180
180
  description=description,
181
+ read_only=True,
181
182
  )
182
183
  elif isinstance(field, models.UUIDField):
183
184
  return SchemaFieldMetadata(
@@ -187,6 +188,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
187
188
  nullable=False,
188
189
  format=FieldFormat.UUID,
189
190
  description=description,
191
+ read_only=True,
190
192
  )
191
193
  elif isinstance(field, models.CharField):
192
194
  return SchemaFieldMetadata(
@@ -197,6 +199,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
197
199
  format=FieldFormat.ID,
198
200
  max_length=field.max_length,
199
201
  description=description,
202
+ read_only=True,
200
203
  )
201
204
  else:
202
205
  return SchemaFieldMetadata(
@@ -206,6 +209,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
206
209
  nullable=False,
207
210
  format=FieldFormat.ID,
208
211
  description=description,
212
+ read_only=True,
209
213
  )
210
214
 
211
215
  def get_field_metadata(
@@ -286,6 +290,12 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
286
290
  elif callable(default):
287
291
  default = default()
288
292
 
293
+ # Check if field should be read-only (auto_now or auto_now_add)
294
+ read_only = False
295
+ if isinstance(field, (models.DateTimeField, models.DateField)):
296
+ if getattr(field, "auto_now", False) or getattr(field, "auto_now_add", False):
297
+ read_only = True
298
+
289
299
  return SchemaFieldMetadata(
290
300
  type=field_type,
291
301
  title=title,
@@ -299,6 +309,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
299
309
  max_digits=max_digits,
300
310
  decimal_places=decimal_places,
301
311
  description=description,
312
+ read_only=read_only,
302
313
  )
303
314
 
304
315
  def get_field_title(self, field: models.Field) -> str:
@@ -386,8 +386,19 @@ class ASTParser:
386
386
 
387
387
  # If any permission allows all fields
388
388
  if fields == "__all__":
389
- return all_fields
390
-
389
+ # NEW: For read operations, default "__all__" to frontend_fields
390
+ if operation_type == "read":
391
+ # If frontend_fields is also "__all__", then return all fields
392
+ if model_config.frontend_fields == "__all__":
393
+ return all_fields
394
+ # Otherwise, use frontend_fields as the default for "__all__"
395
+ else:
396
+ fields = model_config.frontend_fields
397
+ fields &= all_fields # Ensure fields actually exist
398
+ allowed_fields |= fields
399
+ else:
400
+ # For create/update operations, "__all__" means truly all fields
401
+ return all_fields
391
402
  # Add allowed fields from this permission
392
403
  else: # Ensure we're not operating on the string "__all__"
393
404
  fields &= all_fields # Ensure fields actually exist
@@ -181,6 +181,7 @@ class ModelConfig:
181
181
  searchable_fields: Optional[Union[Set[str], Literal["__all__"]]] = None,
182
182
  ordering_fields: Optional[Union[Set[str], Literal["__all__"]]] = None,
183
183
  fields: Optional[Union[Set[str], Literal["__all__"]]] = None,
184
+ frontend_fields: Optional[Union[Set[str], Literal["__all__"]]] = None,
184
185
  display: Optional[Any] = None,
185
186
  DEBUG: bool = False,
186
187
  ):
@@ -195,6 +196,7 @@ class ModelConfig:
195
196
  self.searchable_fields = searchable_fields or set()
196
197
  self.ordering_fields = ordering_fields or set()
197
198
  self.fields = fields or "__all__"
199
+ self.frontend_fields = frontend_fields or self.fields
198
200
  self.display = display
199
201
  self.DEBUG = DEBUG or False
200
202
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statezero
3
- Version: 0.1.0b13
3
+ Version: 0.1.0b15
4
4
  Summary: Connect your Python backend to a modern JavaScript SPA frontend with 90% less complexity.
5
5
  Author-email: Robert <robert.herring@statezero.dev>
6
6
  Project-URL: homepage, https://www.statezero.dev
File without changes
File without changes
File without changes