Adding delete workflow
This commit is contained in:
parent
e5395b6b19
commit
54d1cc810c
3
member/static/icons/heroicons/trash.svg
Normal file
3
member/static/icons/heroicons/trash.svg
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4">
|
||||||
|
<path fill-rule="evenodd" d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z" clip-rule="evenodd" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 603 B |
12
member/templates/confirm_delete.html
Normal file
12
member/templates/confirm_delete.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "master.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="members-table">
|
||||||
|
<h3>Mitglied löschen</h3>
|
||||||
|
<p>Möchtest du <strong>{{ person.nachname }} {{person.vorname}}</strong> wirklich löschen?</p>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button" type="submit">Ja, löschen</button>
|
||||||
|
<a href="{% url 'members' %}" class="button" style="background:#444;">Abbrechen</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'details' x.id %}"><img src="{% static 'icons/arrow-right.svg' %}" class="icon">{{ x.nachname }} {{ x.vorname}}</a> </td>
|
<td><a href="{% url 'details' x.id %}"><img src="{% static 'icons/arrow-right.svg' %}" class="icon">{{ x.nachname }} {{ x.vorname}}</a> </td>
|
||||||
<td>{% if x.aktiv %}{% inline_svg 'icons/uxwing/check.svg' 'icon' %}{% endif %}</td>
|
<td>{% if x.aktiv %}{% inline_svg 'icons/uxwing/check.svg' 'icon' %}{% endif %}</td>
|
||||||
<td><a href="{% url 'edit' x.id %}" title="Bearbeiten"><img src="{% static 'icons/heroicons/pencil.svg'%}" class="icon"></a></td>
|
<td><a href="{% url 'edit' x.id %}" title="Bearbeiten"><img src="{% static 'icons/heroicons/pencil.svg'%}" class="icon"></a> <a href="{% url 'delete' x.id %}" title="Löschen"><img src="{% static 'icons/heroicons/trash.svg'%}" class="icon"></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -6,4 +6,5 @@ urlpatterns = [
|
|||||||
path('members/details/<int:id>', views.details, name="details"),
|
path('members/details/<int:id>', views.details, name="details"),
|
||||||
path('members/create/', views.create, name="create"),
|
path('members/create/', views.create, name="create"),
|
||||||
path('members/edit/<int:id>', views.edit, name="edit"),
|
path('members/edit/<int:id>', views.edit, name="edit"),
|
||||||
|
path('members/delete/<int:id>', views.delete, name="delete"),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -40,3 +40,10 @@ def edit(request, id):
|
|||||||
else:
|
else:
|
||||||
form = PersonForm(instance=person)
|
form = PersonForm(instance=person)
|
||||||
return render(request, 'person_form.html', {'form': form, 'action': 'Bearbeiten'})
|
return render(request, 'person_form.html', {'form': form, 'action': 'Bearbeiten'})
|
||||||
|
|
||||||
|
def delete(request, id):
|
||||||
|
person = get_object_or_404(Person, id=id)
|
||||||
|
if request.method == 'POST':
|
||||||
|
person.delete()
|
||||||
|
return redirect('members')
|
||||||
|
return render(request, 'confirm_delete.html', { 'person': person})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user