You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the serializer successfully with my data model, but I was wondering if there's a simple way to get it to filter out "null" items when serializing models or dictionaries?
My data is pulled from Postgresql, and as I'm feeding much of it to SOLR for indexing purposes, I'd like to reduce the document size and eliminate unneeded elements from the JSON output. If there's already an option in the Serializer I'm missing or an easy way to accomplish this via the model, I'd appreciate a pointer.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
If so I can add an option for you, it doesn't look difficult and should not affect performance.
Smth like the following: model.to_dict(only=('...',), sieve=lambda x: x is not None)
Using the serializer successfully with my data model, but I was wondering if there's a simple way to get it to filter out "null" items when serializing models or dictionaries?
My data is pulled from Postgresql, and as I'm feeding much of it to SOLR for indexing purposes, I'd like to reduce the document size and eliminate unneeded elements from the JSON output. If there's already an option in the Serializer I'm missing or an easy way to accomplish this via the model, I'd appreciate a pointer.
Thanks in advance.
The text was updated successfully, but these errors were encountered: