Commit 5880ee1e by Őry Máté

dashboard: refactor ops ajax functionality to AjaxOperationMixin

parent e9439649
...@@ -608,14 +608,11 @@ class OperationView(RedirectToLoginMixin, DetailView): ...@@ -608,14 +608,11 @@ class OperationView(RedirectToLoginMixin, DetailView):
return me return me
class VmOperationView(OperationView): class AjaxOperationMixin(object):
model = Instance
context_object_name = 'instance' # much simpler to mock object
def post(self, request, extra=None, *args, **kwargs): def post(self, request, extra=None, *args, **kwargs):
resp = super(VmOperationView, self).post(request, extra, *args, resp = super(AjaxOperationMixin, self).post(
**kwargs) request, extra, *args, **kwargs)
if request.is_ajax(): if request.is_ajax():
store = messages.get_messages(request) store = messages.get_messages(request)
store.used = True store.used = True
...@@ -628,6 +625,12 @@ class VmOperationView(OperationView): ...@@ -628,6 +625,12 @@ class VmOperationView(OperationView):
return resp return resp
class VmOperationView(AjaxOperationMixin, OperationView):
model = Instance
context_object_name = 'instance' # much simpler to mock object
class FormOperationMixin(object): class FormOperationMixin(object):
form_class = None form_class = None
......
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