make edit/delete links target specific forms (#24166)

This commit is contained in:
Frédéric Péters 2018-06-05 16:33:48 +02:00
parent 16f00d67fc
commit 73eb8c173a
3 changed files with 4 additions and 4 deletions

View File

@ -41,10 +41,10 @@
<td class="action-column" rowspan={{ row.record.description|yesno:"2,1" }}>
{% block action-column %}
{% if table.context.include_edit_link or include_edit_link %}<!-- dj11 compatibility -->
<a class="icon-edit" rel="popup" href="{% url 'edit' pk=row.record.pk %}"></a>
<a class="icon-edit" rel="popup" data-selector="#edit-form" href="{% url 'edit' pk=row.record.pk %}"></a>
{% endif %}
{% if row.record.deletable_by_user %}
<a class="icon-remove" rel="popup" href="{% url 'delete' pk=row.record.pk %}"></a>
<a class="icon-remove" rel="popup" data-selector="#delete-form" href="{% url 'delete' pk=row.record.pk %}"></a>
{% endif %}
{% endblock %}
</td>

View File

@ -2,7 +2,7 @@
{% load i18n %}
{% block content %}
<form method="post">
<form method="post" id="delete-form">
{% csrf_token %}
<p>
{% blocktrans %}Are you sure you want to delete "{{ object }}"?{% endblocktrans %}

View File

@ -6,7 +6,7 @@
<h2>{% trans "Edit" %}</h2>
</div>
<form action="{% url 'edit' pk=object.pk %}" method="post">
<form action="{% url 'edit' pk=object.pk %}" method="post" id="edit-form">
{% csrf_token %}
{{form.as_p}}
<div class="buttons">