Commit b722b632 by Oláh István Gergely

dashboard: fix node flush templates, check is None to post flush

parent 39f2c65c
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
{% if text %} {% if text %}
{{ text }} {{ text }}
{% else %} {% else %}
...@@ -10,12 +11,16 @@ ...@@ -10,12 +11,16 @@
Are you sure you want to flush <strong>{{ object }}</strong>? Are you sure you want to flush <strong>{{ object }}</strong>?
{%endblocktrans%} {%endblocktrans%}
{% endif %} {% endif %}
<br /> <div class="pull-right">
<div class="pull-right" style="margin-top: 15px;"> <form action="" method="POST">
{% csrf_token %}
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Cancel" %}</button> <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Cancel" %}</button>
<button id="confirmation-modal-button" type="button" class="btn btn-warning">{% trans "Flush" %}</button> <input type="hidden" name="flush" value=""/>
<button class="btn btn-warning">{% trans "Yes" %}</button>
</form>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
......
{% extends "dashboard/base.html" %} {% extends "dashboard/base.html" %}
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<div class="body-content"> <div class="body-content">
<div class="panel panel-default"> <div class="panel panel-default">
...@@ -25,8 +24,8 @@ ...@@ -25,8 +24,8 @@
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
<a class="btn btn-default">{% trans "Back" %}</a> <a class="btn btn-default">{% trans "Back" %}</a>
<input type="hidden" name="next" value="{{ request.GET.next }}"/> <input type="hidden" name="flush" value=""/>
<button class="btn btn-warning">{% trans "Yes, flush" %}</button> <button class="btn btn-warning">{% trans "Yes" %}</button>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -497,14 +497,13 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView): ...@@ -497,14 +497,13 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return context return context
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
print request.POST
if request.POST.get('new_name'): if request.POST.get('new_name'):
return self.__set_name(request) return self.__set_name(request)
if request.POST.get('change_status') is not None: if request.POST.get('change_status') is not None:
return self.__set_status(request) return self.__set_status(request)
if request.POST.get('to_remove'): if request.POST.get('to_remove'):
return self.__remove_trait(request) return self.__remove_trait(request)
if request.POST.get('flush'): if request.POST.get('flush') is not None:
return self.__flush(request) return self.__flush(request)
return redirect(reverse_lazy("dashboard.views.node-detail", return redirect(reverse_lazy("dashboard.views.node-detail",
kwargs={'pk': self.get_object().pk})) kwargs={'pk': self.get_object().pk}))
......
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