Commit fdf0285a by Czémán Arnold

dashboard: remove unnecessary get_rename_operation() method

parent 9211165c
Pipeline #182 passed with stage
in 0 seconds
......@@ -55,7 +55,7 @@
</div>
<h1>
<div id="vm-details-rename" class="vm-details-home-rename-form-div">
<form action="{{ rename_op.get_url }}" method="POST" id="vm-details-rename-form">
<form action="{{ op.rename.get_url }}" method="POST" id="vm-details-rename-form">
{% csrf_token %}
<div class="input-group vm-details-home-name">
<input id="vm-details-rename-name" class="form-control input-sm" name="new_name" type="text" value="{{ instance.name }}"/>
......
......@@ -16,7 +16,7 @@
<small class="vm-details-home-edit-name">{{ instance.name }}</small>
</div>
<div class="js-hidden vm-details-home-rename-form-div" id="vm-details-home-rename">
<form action="{{ rename_op.get_url }}" method="POST">
<form action="{{ op.rename.get_url }}" method="POST">
{% csrf_token %}
<div class="input-group">
<input type="text" name="new_name" value="{{ instance.name }}" class="form-control input-sm"/>
......
......@@ -134,7 +134,6 @@ class VmDetailView(GraphMixin, CheckedDetailView):
kwargs={'pk': self.object.pk}),
'ops': ops,
'op': {i.op: i for i in ops},
'rename_op': self.get_rename_operation(instance),
'connect_commands': user.profile.get_connect_commands(instance),
'hide_tutorial': hide_tutorial,
'fav': instance.favourite_set.filter(user=user).exists(),
......@@ -284,19 +283,6 @@ class VmDetailView(GraphMixin, CheckedDetailView):
return HttpResponseRedirect("%s#activity" %
self.object.get_absolute_url())
def get_rename_operation(self, instance):
v = VmRenameView
try:
op = v.get_op_by_object(instance)
op.check_auth(self.request.user)
op.check_precond()
except PermissionDenied as e:
logger.debug('Not showing operation %s for %s: %s',
'rename', instance, unicode(e))
except Exception:
return v.bind_to_object(instance, disabled=True)
return v.bind_to_object(instance)
class VmTraitsUpdate(SuperuserRequiredMixin, UpdateView):
form_class = TraitsForm
......
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