Commit 1c151318 by Őry Máté

dashboard: add OperationView.with_reload default value

parent 7e5a2690
......@@ -518,6 +518,7 @@ class OperationView(RedirectToLoginMixin, DetailView):
show_in_toolbar = True
effect = None
wait_for_result = None
with_reload = False
@property
def name(self):
......@@ -660,13 +661,14 @@ class AjaxOperationMixin(object):
resp = super(AjaxOperationMixin, self).post(
request, extra, *args, **kwargs)
if request.is_ajax():
store = []
if not getattr(self, "with_reload", False):
if not self.with_reload:
store = messages.get_messages(request)
store.used = True
else:
store = []
return HttpResponse(
json.dumps({'success': True,
'with_reload': getattr(self, 'with_reload', False),
'with_reload': self.with_reload,
'messages': [unicode(m) for m in store]}),
content_type="application=json"
)
......@@ -708,9 +710,8 @@ class FormOperationMixin(object):
return HttpResponse(
json.dumps({
'success': True,
'with_reload': getattr(self, 'with_reload', False)}),
content_type="application=json"
)
'with_reload': self.with_reload}),
content_type="application=json")
else:
return resp
else:
......@@ -720,7 +721,7 @@ class FormOperationMixin(object):
class RequestFormOperationMixin(FormOperationMixin):
def get_form_kwargs(self):
val = super(FormOperationMixin, self).get_form_kwargs()
val = super(RequestFormOperationMixin, self).get_form_kwargs()
val.update({'request': self.request})
return val
......
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