sqladmin 0.20.0__py3-none-any.whl → 0.20.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.
sqladmin/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from sqladmin.application import Admin, action, expose
2
2
  from sqladmin.models import BaseView, ModelView
3
3
 
4
- __version__ = "0.20.0"
4
+ __version__ = "0.20.1"
5
5
 
6
6
  __all__ = [
7
7
  "Admin",
sqladmin/models.py CHANGED
@@ -403,16 +403,16 @@ class ModelView(BaseView, metaclass=ModelViewMeta):
403
403
  Normally, objects have three save options:
404
404
  ``Save`, `Save and continue editing` and `Save and add another`.
405
405
 
406
- If save_as is True, `Save and add another` will be replaced
407
- by a `Save as new` button
408
- that creates a new object (with a new ID)
406
+ If save_as is True, `Save and add another` will be replaced
407
+ by a `Save as new` button
408
+ that creates a new object (with a new ID)
409
409
  rather than updating the existing object.
410
410
 
411
411
  By default, `save_as` is set to `False`.
412
412
  """
413
413
 
414
414
  save_as_continue: ClassVar[bool] = True
415
- """When `save_as=True`, the default redirect after saving the new object
415
+ """When `save_as=True`, the default redirect after saving the new object
416
416
  is to the edit view for that object.
417
417
  If you set `save_as_continue=False`, the redirect will be to the list view.
418
418
 
@@ -1194,14 +1194,16 @@ class ModelView(BaseView, metaclass=ModelViewMeta):
1194
1194
  ) -> StreamingResponse:
1195
1195
  async def generate() -> AsyncGenerator[str, None]:
1196
1196
  yield "["
1197
- separator = "," if len(data) > 1 else ""
1197
+ len_data = len(data)
1198
+ last_idx = len_data - 1
1199
+ separator = "," if len_data > 1 else ""
1198
1200
 
1199
- for row in data:
1201
+ for idx, row in enumerate(data):
1200
1202
  row_dict = {
1201
- name: await self.get_prop_value(row, name)
1203
+ name: str(await self.get_prop_value(row, name))
1202
1204
  for name in self._export_prop_names
1203
1205
  }
1204
- yield json.dumps(row_dict) + separator
1206
+ yield json.dumps(row_dict) + (separator if idx < last_idx else "")
1205
1207
 
1206
1208
  yield "]"
1207
1209
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sqladmin
3
- Version: 0.20.0
3
+ Version: 0.20.1
4
4
  Summary: SQLAlchemy admin for FastAPI and Starlette
5
5
  Project-URL: Documentation, https://aminalaee.dev/sqladmin
6
6
  Project-URL: Issues, https://github.com/aminalaee/sqladmin/issues
@@ -1,4 +1,4 @@
1
- sqladmin/__init__.py,sha256=J9RDjM9xYLz2BbBMrYu0KfRxirw6tKr5hyr1xcoPi2g,216
1
+ sqladmin/__init__.py,sha256=3kjWCBseZv6vxNmMtKgrBicZUgE93ZwOF14aquXK_p0,216
2
2
  sqladmin/_menu.py,sha256=V6uKvIJGKrC0kmXq4M-DAgvPoHvgoGgKAw47OjsswGA,2609
3
3
  sqladmin/_queries.py,sha256=KqxMABvepoA0j-8Xizg6ASYS-sZDSdm5iFlU74vilQY,9697
4
4
  sqladmin/_types.py,sha256=3Zs0aPb14OS-9leahKxxzFopnIOiNftPZwdUmFDBKog,347
@@ -11,7 +11,7 @@ sqladmin/fields.py,sha256=1CWoVSMr1WkhBJww0-rakx71gRATeIGA6dKgc26z99M,11660
11
11
  sqladmin/formatters.py,sha256=K06la0mm9-Bs5UA9L6KGJC_X_lV3UHdJ3ENI6j9j2Zg,480
12
12
  sqladmin/forms.py,sha256=5VhbRWbsG23eDAGz2c03HnED-titNkBdYzDr-TaBSi0,21541
13
13
  sqladmin/helpers.py,sha256=VTPOFbWkiC1My6MYYyVUCAdg7UmnViiYE2ZigiXx628,8615
14
- sqladmin/models.py,sha256=7VFwuxz7oixl9jLD8QPLxlCErCUDdPWf3Ob60kOoF20,40630
14
+ sqladmin/models.py,sha256=Ygm5UetuHdn62n1zU5rukNs3dbjypgNC8NfVte9IIXY,40743
15
15
  sqladmin/pagination.py,sha256=zg_bAvqZd2Rf0wKJ7uiVfNV9vR0hrsilmi9Ak0SOG_U,2600
16
16
  sqladmin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  sqladmin/templating.py,sha256=o-QMikTrOEgrneLonqCWR3SpAthr-9DoMwOmobM9zq0,2252
@@ -47,7 +47,7 @@ sqladmin/templates/sqladmin/login.html,sha256=Y_hlcIapfVFPNbSIbCe4Tbj5DLLD46emkS
47
47
  sqladmin/templates/sqladmin/modals/delete.html,sha256=jTuv6geT-AhK5HTgRmntrJ8CEi98-kwKrVDrzkOQWhw,1092
48
48
  sqladmin/templates/sqladmin/modals/details_action_confirmation.html,sha256=mN8LJ5OqypxNLAg2_GYZgQmGeK4E6t7JL5RmOEYuliM,1020
49
49
  sqladmin/templates/sqladmin/modals/list_action_confirmation.html,sha256=U52LLNmpLaMuUZSVtGK15oLXsEu6m2S3l9zj9sjN6uM,1078
50
- sqladmin-0.20.0.dist-info/METADATA,sha256=YgbcA1NS7mKPEmMDPlMMOpkU7z3rcYMi-JLqOMe2hPM,5270
51
- sqladmin-0.20.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
52
- sqladmin-0.20.0.dist-info/licenses/LICENSE.md,sha256=4zzpHQMPtND4hzIgJA5qnb4R_wRBWJlYGqNrZolBeP8,1488
53
- sqladmin-0.20.0.dist-info/RECORD,,
50
+ sqladmin-0.20.1.dist-info/METADATA,sha256=ypbLpPnHwEMZZov5kKz416eplyFOOBwkp1BhWICYHWM,5270
51
+ sqladmin-0.20.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
52
+ sqladmin-0.20.1.dist-info/licenses/LICENSE.md,sha256=4zzpHQMPtND4hzIgJA5qnb4R_wRBWJlYGqNrZolBeP8,1488
53
+ sqladmin-0.20.1.dist-info/RECORD,,