From a61c0c10692f5e36c2444c614616d037f380c6aa Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Wed, 23 Jan 2019 11:01:57 +0300 Subject: [PATCH] fix --- djing/lib/decorators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/djing/lib/decorators.py b/djing/lib/decorators.py index 4e608fb..8b2c8ff 100644 --- a/djing/lib/decorators.py +++ b/djing/lib/decorators.py @@ -99,9 +99,9 @@ def json_view(fn): @wraps(fn) def wrapped(request, *args, **kwargs): r = fn(request, *args, **kwargs) - if r and 'text' in r.keys() and not isinstance(r['text'], str): + if isinstance(r, dict) and not isinstance(r.get('text'), str): r['text'] = str(r['text']) - return JsonResponse(dict(r or {'text': 'null'}), safe=False, json_dumps_params={ + return JsonResponse(r, safe=False, json_dumps_params={ 'ensure_ascii': False }) return wrapped