Commit fdf0285a by Czémán Arnold

dashboard: remove unnecessary get_rename_operation() method

parent 9211165c
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</div> </div>
<h1> <h1>
<div id="vm-details-rename" class="vm-details-home-rename-form-div"> <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 %} {% csrf_token %}
<div class="input-group vm-details-home-name"> <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 }}"/> <input id="vm-details-rename-name" class="form-control input-sm" name="new_name" type="text" value="{{ instance.name }}"/>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<small class="vm-details-home-edit-name">{{ instance.name }}</small> <small class="vm-details-home-edit-name">{{ instance.name }}</small>
</div> </div>
<div class="js-hidden vm-details-home-rename-form-div" id="vm-details-home-rename"> <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 %} {% csrf_token %}
<div class="input-group"> <div class="input-group">
<input type="text" name="new_name" value="{{ instance.name }}" class="form-control input-sm"/> <input type="text" name="new_name" value="{{ instance.name }}" class="form-control input-sm"/>
......
...@@ -134,7 +134,6 @@ class VmDetailView(GraphMixin, CheckedDetailView): ...@@ -134,7 +134,6 @@ class VmDetailView(GraphMixin, CheckedDetailView):
kwargs={'pk': self.object.pk}), kwargs={'pk': self.object.pk}),
'ops': ops, 'ops': ops,
'op': {i.op: i for i in ops}, 'op': {i.op: i for i in ops},
'rename_op': self.get_rename_operation(instance),
'connect_commands': user.profile.get_connect_commands(instance), 'connect_commands': user.profile.get_connect_commands(instance),
'hide_tutorial': hide_tutorial, 'hide_tutorial': hide_tutorial,
'fav': instance.favourite_set.filter(user=user).exists(), 'fav': instance.favourite_set.filter(user=user).exists(),
...@@ -284,19 +283,6 @@ class VmDetailView(GraphMixin, CheckedDetailView): ...@@ -284,19 +283,6 @@ class VmDetailView(GraphMixin, CheckedDetailView):
return HttpResponseRedirect("%s#activity" % return HttpResponseRedirect("%s#activity" %
self.object.get_absolute_url()) 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): class VmTraitsUpdate(SuperuserRequiredMixin, UpdateView):
form_class = TraitsForm 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