Commit 816292e2 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Update of the runner delete view



I updated the view by changing the route, renaming the class view and
update the templates accordingly.

Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 35124c7c
......@@ -37,8 +37,8 @@ urlpatterns = [
url(r'^runners/$', views.RunnerList.as_view(), name='runner_list'),
url(r'^runners/add/$', views.RunnerCreate.as_view(), name='runner_create'),
url(r'^settings/runners/delete/(?P<pk>\d+)/$', views.UserRunnerDeleteView.as_view(), name='user_runner_delete'),
url(r'^runners/(?P<pk>\d+)/update/$', views.RunnerUpdate.as_view(), name='runner_update'),
url(r'^runners/(?P<pk>\d+)/delete/$', views.RunnerDelete.as_view(), name='runner_delete'),
]
"""
......
......@@ -658,12 +658,6 @@ class WebappCreateJobView(SuccessMessageMixin, LoginRequiredMixin, CreateView):
return super(WebappCreateJobView, self).get_context_data(**kwargs)
class UserRunnerDeleteView(SuccessMessageMixin, LoginRequiredMixin, DeleteView):
model = Runner
success_message = 'Runner successfully deleted.'
success_url = reverse_lazy('main:user_runner_list')
template_name = 'user_runner_delete.html'
......@@ -847,3 +841,10 @@ class RunnerUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
kwargs = super(RunnerUpdate, self).get_form_kwargs()
kwargs['request'] = self.request
return kwargs
class RunnerDelete(SuccessMessageMixin, LoginRequiredMixin, DeleteView):
model = Runner
success_message = 'Runner successfully deleted.'
success_url = reverse_lazy('main:runner_list')
template_name = 'runner_delete.html'
......@@ -4,25 +4,18 @@
{% block title %}Delete the runner{% endblock %}
{% block breadcrumb %}
<li class="breadcrumb-item"><a href="{% url 'main:user_settings' %}">Settings</a></li>
<li class="breadcrumb-item"><a href="{% url 'main:user_runner_list' %}">Runners</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete runner</li>
<li class="breadcrumb-item"><a href="{% url 'main:runner_list' %}">Runners</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li>
{% endblock %}
{% block content %}
<div class="container">
<div class="allgo-page">
<div class="row">
{% include 'partials/_user_settings_menu.html' %}
<div class="col-10">
<form method="post">
{% csrf_token %}
<p><strong>Are you sure you want to delete this runner?</strong></p>
<input class="btn btn-primary" type="submit" value="Confirm">
</form>
</div>
</div>
</div>
</div>
{% endblock %}
......@@ -30,14 +23,4 @@
{% block messages %}
{{ block.super }}
{% for field in form %}
{% for error in field.errors %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<div class="container">{{ error|escape }}</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endfor %}
{% endblock %}
......@@ -40,7 +40,7 @@
{% endfor %}
</td>
<td><a href="{% url 'main:runner_update' runner.id %}"><i class="fas fa-pencil-alt"></i></a></td>
<td><a href="{% url 'main:user_runner_delete' runner.id %}"><i class="fas fa-trash-alt"></i></a></td>
<td><a class="btn btn-danger" href="{% url 'main:runner_delete' runner.id %}"><i class="fas fa-trash-alt"></i></a></td>
</tr>
{% endfor %}
</tbody>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment