Skip to content
Snippets Groups Projects
Verified Commit d58a3f7f authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Use `encode()` to encode unwrapped lazy object

The unwrapped structure needs to go through the main encoding function again, because that handles plain Python types.
parent 7233f1b2
No related branches found
No related tags found
1 merge request!601Resolve "favicon / icon generation mauls database"
Pipeline #10700 canceled
......@@ -273,6 +273,6 @@ def monkey_patch() -> None: # noqa
class DjangoJSONEncoder(json.DjangoJSONEncoder):
def default(self, o: Any) -> Any:
if isinstance(o, Promise) and hasattr(o, "copy"):
return super().default(o.copy())
return super().encode(o.copy())
return super().default(o)
json.DjangoJSONEncoder = DjangoJSONEncoder
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment