# HG changeset patch # User neko259 # Date 2015-04-03 13:18:36 # Node ID d66b97782aefe387c1618770b06b83be31d61244 # Parent 7609c9201bb4b1a1fe3856ea5195aa192afec862 Use dict instead of context instance in post view API diff --git a/boards/views/api.py b/boards/views/api.py --- a/boards/views/api.py +++ b/boards/views/api.py @@ -20,6 +20,7 @@ PARAMETER_TRUNCATED = 'truncated' PARAMETER_TAG = 'tag' PARAMETER_OFFSET = 'offset' PARAMETER_DIFF_TYPE = 'type' +PARAMETER_POST = 'post' DIFF_TYPE_HTML = 'html' DIFF_TYPE_JSON = 'json' @@ -114,13 +115,12 @@ def get_post(request, post_id): post = get_object_or_404(Post, id=post_id) - context = RequestContext(request) - context['post'] = post + params = dict() + params[PARAMETER_POST] = post if PARAMETER_TRUNCATED in request.GET: - context[PARAMETER_TRUNCATED] = True + params[PARAMETER_TRUNCATED] = True - # TODO Use dict here - return render(request, 'boards/api_post.html', context_instance=context) + return render(request, 'boards/api_post.html', params) def api_get_threads(request, count):