statezero 0.1.0b14__py3-none-any.whl → 0.1.0b16__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.

Potentially problematic release.


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

@@ -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(
@@ -256,6 +260,9 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
256
260
  elif isinstance(field, models.DateField):
257
261
  field_type = FieldType.STRING
258
262
  field_format = FieldFormat.DATE
263
+ elif isinstance(field, models.TimeField):
264
+ field_type = FieldType.STRING
265
+ field_format = FieldFormat.TIME
259
266
  elif isinstance(field, (models.ForeignKey, models.OneToOneField)):
260
267
  field_type = self.get_pk_type(field)
261
268
  field_format = self.get_relation_type(field)
@@ -286,6 +293,12 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
286
293
  elif callable(default):
287
294
  default = default()
288
295
 
296
+ # Check if field should be read-only (auto_now or auto_now_add)
297
+ read_only = False
298
+ if isinstance(field, (models.DateTimeField, models.DateField, models.TimeField)):
299
+ if getattr(field, "auto_now", False) or getattr(field, "auto_now_add", False):
300
+ read_only = True
301
+
289
302
  return SchemaFieldMetadata(
290
303
  type=field_type,
291
304
  title=title,
@@ -299,6 +312,7 @@ class DjangoSchemaGenerator(AbstractSchemaGenerator):
299
312
  max_digits=max_digits,
300
313
  decimal_places=decimal_places,
301
314
  description=description,
315
+ read_only=read_only,
302
316
  )
303
317
 
304
318
  def get_field_title(self, field: models.Field) -> str:
statezero/core/classes.py CHANGED
@@ -71,6 +71,7 @@ class FieldFormat(str, Enum):
71
71
  TEXT = "text"
72
72
  DATE = "date"
73
73
  DATETIME = "date-time"
74
+ TIME = "time"
74
75
  FOREIGN_KEY = "foreign-key"
75
76
  ONE_TO_ONE = "one-to-one"
76
77
  MANY_TO_MANY = "many-to-many"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statezero
3
- Version: 0.1.0b14
3
+ Version: 0.1.0b16
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
@@ -13,7 +13,7 @@ statezero/adaptors/django/middleware.py,sha256=YVr8fkqCk51xJQM-ovtrUiB9Kt9H81cLd
13
13
  statezero/adaptors/django/orm.py,sha256=Z62XheCvuKIpKOoIIiLLOwrpJ5jPhv-BGxg-pqPgNaU,40757
14
14
  statezero/adaptors/django/permissions.py,sha256=fU2c4bKK0zX2uuVB0UazZHTI-5OkiI5-BtPNcPEWmW0,9525
15
15
  statezero/adaptors/django/query_optimizer.py,sha256=-iAh5kyE8WNZdjb_qBbNag_nxKzejroUYPBdwG_uVaQ,41462
16
- statezero/adaptors/django/schemas.py,sha256=YYWvtg-SNcARBZPl51zb4tY2BStcXDYbprKSyS3mIbM,13467
16
+ statezero/adaptors/django/schemas.py,sha256=E-crPopLIFpcCVE31d39KAv1r_B0XNS7iCR09WjFvGo,14091
17
17
  statezero/adaptors/django/serializers.py,sha256=YFFDu6bzoWkSEOVH5Wmc4yJ8SaOkUA6HbXXYt6djlfc,23296
18
18
  statezero/adaptors/django/urls.py,sha256=OrGQ60vj_wrbiREAKmYDZTwohpKmgjH9n0fdOw1qPaY,924
19
19
  statezero/adaptors/django/views.py,sha256=2bJDbXuRGoG2_7zyapWzmRzpSVUHkCpcI58wsrXN1jc,19947
@@ -31,7 +31,7 @@ statezero/core/__init__.py,sha256=Z6RTutAAElLMEjBFphVVmpySPdJBA55j-Uo0BtR7c5E,10
31
31
  statezero/core/actions.py,sha256=eq4zuDhK1h-nZ24jUQhiWL6BcMqq-W4BhdVNdYegymw,2969
32
32
  statezero/core/ast_parser.py,sha256=QTFRDwanN2jJJOs4SeRdRPiVZWlK-tkmwZBlQNByew0,39321
33
33
  statezero/core/ast_validator.py,sha256=YZAflPyba0kXWBNhd1Z_XeEk-_zUzM6MkY9zSlX1PMs,11582
34
- statezero/core/classes.py,sha256=NLIiOPm6PwQAmJXFeN2iScdoGeHyimzdnXmyyfBM-NY,6977
34
+ statezero/core/classes.py,sha256=TlJYUhiYniTJqZCSVo_-85mgJ4muhCPpJWxlgG-Vph8,6996
35
35
  statezero/core/config.py,sha256=kOcQPzBA06d8EliP2bVY0daFlt8bm-8ZOsqb5x7-8JA,11822
36
36
  statezero/core/context_storage.py,sha256=DVx525ZMRorj41kg5K0N6pPdGkQ5_XEJcBucpH5ChxQ,162
37
37
  statezero/core/event_bus.py,sha256=2IFLBHSkLzpm1AX0MfSXSmF2X-lXK-gOoODZCtB2Jdw,6284
@@ -41,8 +41,8 @@ statezero/core/hook_checks.py,sha256=uqtvwRx1qGsF7Vc49elAWdOjMzhuv3RADKY1wiLvhK4
41
41
  statezero/core/interfaces.py,sha256=kVkNWyh52tUlzD02CRheLJof3DyQoVcPuvX33fL6sn8,20544
42
42
  statezero/core/process_request.py,sha256=dwIeBEVOE8zA-oE1h65XNOGiVqFbbXA7SzTAguLNgZk,8060
43
43
  statezero/core/types.py,sha256=mMtqK3fGhEM6LtzUgQrxlyP-V0VgVqc-1eVKgRjTzp0,913
44
- statezero-0.1.0b14.dist-info/licenses/license.md,sha256=0uKjybTt9K_YbEmYgf25JN292qjjJ-BPofvIZ3wdtX4,7411
45
- statezero-0.1.0b14.dist-info/METADATA,sha256=uhyUyV7nb4_H58RrviWtMXDzZjQDTKxyvUSBxsl38Fo,6704
46
- statezero-0.1.0b14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
- statezero-0.1.0b14.dist-info/top_level.txt,sha256=UAuZYPKczradU1kcMQxsGjUzEW0qdgsqzhXyscrcLpw,10
48
- statezero-0.1.0b14.dist-info/RECORD,,
44
+ statezero-0.1.0b16.dist-info/licenses/license.md,sha256=0uKjybTt9K_YbEmYgf25JN292qjjJ-BPofvIZ3wdtX4,7411
45
+ statezero-0.1.0b16.dist-info/METADATA,sha256=Iwy9H2FRv6eeWVch1qdPCS_-XCq1_rCZW0aQpZEl15c,6704
46
+ statezero-0.1.0b16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
+ statezero-0.1.0b16.dist-info/top_level.txt,sha256=UAuZYPKczradU1kcMQxsGjUzEW0qdgsqzhXyscrcLpw,10
48
+ statezero-0.1.0b16.dist-info/RECORD,,