From c498e23d48548e8048d656677a6b7ee2a9c3fe36 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 18 Oct 2015 23:21:07 +0300 Subject: Fix issue with editing notes and multiple tabs --- servo/views/note.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'servo/views') diff --git a/servo/views/note.py b/servo/views/note.py index 9eb2a4a..19dba8a 100644 --- a/servo/views/note.py +++ b/servo/views/note.py @@ -256,19 +256,18 @@ def delete_note(request, pk): @csrf_exempt -def render_template(request): +def render_template(request, order_id=None): """ Renders the template with this title with the current Service Order as the context """ - content = '' title = request.POST.get('title') tpl = get_object_or_404(Template, title=title) + content = tpl.content - if request.session.get('current_order_id'): - tpl = template.Template(tpl.content) - order = Order.objects.get(pk=request.session['current_order_id']) - content = tpl.render(template.Context({'order': order})) + if order_id: + order = get_object_or_404(Order, pk=order_id) + content = tpl.render(order) return HttpResponse(content) -- cgit v1.2.3