We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, so I had issues when trying to limit the data returned in the share method called inside a middleware. I was doing something like the following:
share
def middleware(request): if request.user: share( request, tenants=lambda: request.user.profiles.select_related( "organization" ).values("organization_id", "organization__name"), ) return get_response(request)
The issue happens inside the InertiaJsonEncoder on here. As it was trying to pass a dictionary to the method model_to_dict.
model_to_dict
The solution I found for this was to add a custom Json encoder as explained in the documentation and do the following:
def default(self, value): if isinstance(value, QuerySet): return [self.default(model) for model in value] if isinstance(value, dict): return value return super().default(value)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, so I had issues when trying to limit the data returned in the
share
method called inside a middleware. I was doing something like the following:The issue happens inside the InertiaJsonEncoder on here. As it was trying to pass a dictionary to the method
model_to_dict
.The solution I found for this was to add a custom Json encoder as explained in the documentation and do the following:
The text was updated successfully, but these errors were encountered: