Commit b2e6c849 by Őry Máté Committed by Bach Dániel

dashboard: fix operation view's template context

parent 3e205b4e
......@@ -14,7 +14,12 @@
</h3>
</div>
<div class="panel-body">
{% if template %}
{% include template %}
{% else %}
{{ body|safe|default:"(body missing from context.)" }}
{% endif %}
</div>
</div>
</div>
{% endblock %}
......@@ -3,7 +3,11 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
{% if template %}
{% include template %}
{% else %}
{{ body|safe|default:"(body missing from context.)" }}
{% endif %}
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
......
......@@ -522,11 +522,11 @@ class OperationView(DetailView):
def get_url(self):
return reverse(self.get_urlname(), args=(self.get_object().pk, ))
def get_wrapper_template_name(self):
def get_template_names(self):
if self.request.is_ajax():
return 'dashboard/_modal.html'
return ['dashboard/_modal.html']
else:
return 'dashboard/_base.html'
return ['dashboard/_base.html']
@classmethod
def get_op_by_object(cls, obj):
......@@ -542,15 +542,12 @@ class OperationView(DetailView):
ctx['op'] = self.get_op()
ctx['opview'] = self
ctx['url'] = self.request.path
ctx['template'] = super(OperationView, self).get_template_names()[0]
return ctx
def get(self, request, *args, **kwargs):
self.get_op().check_auth(request.user)
response = super(OperationView, self).get(request, *args, **kwargs)
response.render()
response.content = render_to_string(self.get_wrapper_template_name(),
{'body': response.content})
return response
return super(OperationView, self).get(request, *args, **kwargs)
def post(self, request, extra=None, *args, **kwargs):
self.object = self.get_object()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment