Commit 5880ee1e by Őry Máté

dashboard: refactor ops ajax functionality to AjaxOperationMixin

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