{{{
return JsonResponse({'error':'Unauthorized access'}, status_code=401)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26262>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => worksforme
* needs_tests: => 0
* needs_docs: => 0
Comment:
Unfortunately due to history, the parameter is named different from the
attribute, i.e. `JsonResponse({'error':'Unauthorized access'},
status=401)`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26262#comment:1>
Comment (by boussouira):
Great, i didn't see that in the documentation of JsonResponse, is it
missing or i didn't see it?
--
Ticket URL: <https://code.djangoproject.com/ticket/26262#comment:2>
* resolution: worksforme => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/26262#comment:3>
Comment (by timgraham):
It could be more explicit I suppose. The docs say, "An `HttpResponse`
subclass that helps to create a JSON-encoded response. It inherits most
behavior from its superclass with a couple differences" and documentation
for `__init__()` shows `**kwargs` in addition to the parameters that are
specific for `JSONResponse`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26262#comment:4>