From 1f2f2bfa784d51b29687f37577a93686ac925d71 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 22 Jan 2019 15:03:55 +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 587f099..4e608fb 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 'text' in r.keys() and not isinstance(r['text'], str): + if r and 'text' in r.keys() and not isinstance(r['text'], str): r['text'] = str(r['text']) - return JsonResponse(dict(r), safe=False, json_dumps_params={ + return JsonResponse(dict(r or {'text': 'null'}), safe=False, json_dumps_params={ 'ensure_ascii': False }) return wrapped