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

dashboard: fix operation view's template context

parent 3e205b4e
...@@ -14,7 +14,12 @@ ...@@ -14,7 +14,12 @@
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if template %}
{% include template %}
{% else %}
{{ body|safe|default:"(body missing from context.)" }} {{ body|safe|default:"(body missing from context.)" }}
{% endif %}
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
{% if template %}
{% include template %}
{% else %}
{{ body|safe|default:"(body missing from context.)" }} {{ body|safe|default:"(body missing from context.)" }}
{% endif %}
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
......
...@@ -522,11 +522,11 @@ class OperationView(DetailView): ...@@ -522,11 +522,11 @@ class OperationView(DetailView):
def get_url(self): def get_url(self):
return reverse(self.get_urlname(), args=(self.get_object().pk, )) 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(): if self.request.is_ajax():
return 'dashboard/_modal.html' return ['dashboard/_modal.html']
else: else:
return 'dashboard/_base.html' return ['dashboard/_base.html']
@classmethod @classmethod
def get_op_by_object(cls, obj): def get_op_by_object(cls, obj):
...@@ -542,15 +542,12 @@ class OperationView(DetailView): ...@@ -542,15 +542,12 @@ class OperationView(DetailView):
ctx['op'] = self.get_op() ctx['op'] = self.get_op()
ctx['opview'] = self ctx['opview'] = self
ctx['url'] = self.request.path ctx['url'] = self.request.path
ctx['template'] = super(OperationView, self).get_template_names()[0]
return ctx return ctx
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.get_op().check_auth(request.user) self.get_op().check_auth(request.user)
response = super(OperationView, self).get(request, *args, **kwargs) return super(OperationView, self).get(request, *args, **kwargs)
response.render()
response.content = render_to_string(self.get_wrapper_template_name(),
{'body': response.content})
return response
def post(self, request, extra=None, *args, **kwargs): def post(self, request, extra=None, *args, **kwargs):
self.object = self.get_object() 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