aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-10-18 23:21:07 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-10-18 23:21:07 +0300
commitc498e23d48548e8048d656677a6b7ee2a9c3fe36 (patch)
treea78e08c21a7ead38b8f95ec9ff0e21946715e0f4 /servo/views
parentcef2dc31b06c7070c5a4e7e3e608402230e1e4b2 (diff)
downloadServo-c498e23d48548e8048d656677a6b7ee2a9c3fe36.tar.gz
Servo-c498e23d48548e8048d656677a6b7ee2a9c3fe36.tar.bz2
Servo-c498e23d48548e8048d656677a6b7ee2a9c3fe36.zip
Fix issue with editing notes and multiple tabs
Diffstat (limited to 'servo/views')
-rw-r--r--servo/views/note.py11
1 files changed, 5 insertions, 6 deletions
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)