From b6ad1fe7f40ef28799e78fbd395480b36e06bacc Mon Sep 17 00:00:00 2001 From: Guanzhong Chen Date: Sun, 30 Oct 2022 16:22:00 -0400 Subject: [PATCH] Don't autofill fields with null --- src/jsonfield/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsonfield/forms.py b/src/jsonfield/forms.py index 02cd563..230033f 100644 --- a/src/jsonfield/forms.py +++ b/src/jsonfield/forms.py @@ -59,6 +59,6 @@ def bound_data(self, data, initial): return InvalidJSONInput(data) def prepare_value(self, value): - if isinstance(value, InvalidJSONInput): + if isinstance(value, InvalidJSONInput) or value is None: return value return json.dumps(value, **self.dump_kwargs)