Skip to content

Commit

Permalink
LITE-28127: fix serialization of Paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
gab832 committed Jul 24, 2023
1 parent a43d0be commit db9dab4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions connect/eaas/core/contrib/django/rql.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dj_rql.transformer import RQLLimitOffsetTransformer
from django.db.models.query import QuerySet
from fastapi import Depends, Request
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from lark.exceptions import LarkError
from py_rql.exceptions import RQLFilterParsingError
Expand Down Expand Up @@ -43,7 +44,7 @@ def serialize(self, queryset, model):
if self.limit + self.offset > self.count:
self.limit = self.count - self.offset
body = [
dict(model.from_orm(item))
dict(jsonable_encoder(model.from_orm(item)))
for item in queryset[self.offset: self.offset + self.limit]
]

Expand All @@ -67,7 +68,7 @@ async def aserialize(self, queryset, model):
if self.limit + self.offset > self.count:
self.limit = self.count - self.offset
body = [
dict(model.from_orm(item))
dict(jsonable_encoder(model.from_orm(item)))
async for item in queryset[self.offset: self.offset + self.limit]
]

Expand Down
2 changes: 1 addition & 1 deletion connect/eaas/core/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
ANVIL_CALLABLE_ATTR_NAME,
ANVIL_KEY_VAR_ATTR_NAME,
CUSTOMER_PAGES_ATTR_NAME,
DJANGO_SECRET_KEY_VAR_ATTR_NAME,
DEVOPS_PAGES_ATTR_NAME,
DJANGO_SECRET_KEY_VAR_ATTR_NAME,
EVENT_INFO_ATTR_NAME,
MODULE_PAGES_ATTR_NAME,
PROXIED_CONNECT_API_ATTR_NAME,
Expand Down

0 comments on commit db9dab4

Please sign in to comment.