Added the window "confirm delete" to the goals list
This commit is contained in:
parent
7fdc0e407f
commit
595a366220
@ -0,0 +1,18 @@
|
||||
{% extends "expenses/base.html" %}
|
||||
{% block title %}Objetivos{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<h1>Eliminar objetivo</h1>
|
||||
|
||||
<p>
|
||||
¿Seguro que quieres eliminar el objetivo
|
||||
<strong>{{ goal.name }}</strong>?
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<button class="btn">Eliminar</button>
|
||||
<a class="btn secondary" href="{% url 'goal_list' %}">Cancelar</a>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@ -943,9 +943,17 @@ def goal_delete(request, pk):
|
||||
pk=pk,
|
||||
owner=request.user)
|
||||
|
||||
if request.method == "POST":
|
||||
goal.delete()
|
||||
messages.success(request, "Objetivo eliminado.")
|
||||
return redirect("goal_list")
|
||||
|
||||
return render(
|
||||
request,
|
||||
"goals/confirm_delete.html",
|
||||
{"active_menu":"settings", "goal":goal}
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def settings_index(request):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user