Skip to content

Commit

Permalink
[#95] Fix: fix Django's truncation on values calls
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanofusai committed Jan 4, 2025
1 parent 65ff0b1 commit 24561d3
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 107 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "drf-caching"
version = "1.5.0"
version = "1.6.0"
description = "Handle views caching in Django Rest Framework."
readme = "README.md"
authors = [
Expand Down
12 changes: 7 additions & 5 deletions src/drf_caching/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _get_data(
for field in obj._meta.get_fields(): # noqa: SLF001
_attr = getattr(obj, field.name)
data[field.name] = (
_attr.all().values_list() if isinstance(_attr, Manager) else _attr
list(_attr.all().values_list()) if isinstance(_attr, Manager) else _attr
)

return data
Expand All @@ -148,7 +148,7 @@ def _get_data(
) -> dict[str, Any]:
return {
"querylist": [
querylist["queryset"].values_list()
list(querylist["queryset"].values_list())
for querylist in view_instance.filter_queryset(
view_instance.get_querylist()
)
Expand All @@ -168,9 +168,11 @@ def _get_data(
**kwargs: Any,
) -> dict[str, Any]:
return {
"queryset": view_instance.filter_queryset(
view_instance.get_queryset()
).values_list()
"queryset": list(
view_instance.filter_queryset(
view_instance.get_queryset()
).values_list()
)
}


Expand Down
Loading

0 comments on commit 24561d3

Please sign in to comment.