Commit e64d3033 by Őry Máté

dashboard: use inheritance for MassOperationView.factory

parent db560b90
...@@ -1012,7 +1012,6 @@ def get_operations(instance, user): ...@@ -1012,7 +1012,6 @@ def get_operations(instance, user):
class MassOperationView(OperationView): class MassOperationView(OperationView):
template_name = 'dashboard/mass-operate.html' template_name = 'dashboard/mass-operate.html'
effect = "info"
@classmethod @classmethod
def get_urlname(cls): def get_urlname(cls):
...@@ -1102,10 +1101,8 @@ class MassOperationView(OperationView): ...@@ -1102,10 +1101,8 @@ class MassOperationView(OperationView):
@classmethod @classmethod
def factory(cls, vm_op, extra_bases=(), **kwargs): def factory(cls, vm_op, extra_bases=(), **kwargs):
kwargs.update({'op': vm_op.op, 'icon': vm_op.icon,
'effect': vm_op.effect})
return type(str(cls.__name__ + vm_op.op), return type(str(cls.__name__ + vm_op.op),
tuple(list(extra_bases) + [cls]), kwargs) tuple(list(extra_bases) + [cls, vm_op]), kwargs)
class MassMigrationView(MassOperationView): class MassMigrationView(MassOperationView):
...@@ -1113,6 +1110,7 @@ class MassMigrationView(MassOperationView): ...@@ -1113,6 +1110,7 @@ class MassMigrationView(MassOperationView):
icon = "info" icon = "info"
op = "migrate" op = "migrate"
icon = "truck" icon = "truck"
effect = "info"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
ctx = super(MassMigrationView, self).get_context_data(**kwargs) ctx = super(MassMigrationView, self).get_context_data(**kwargs)
......
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