Re-enable delete session delete view

This commit is contained in:
Lukáš Kucharczyk 2024-06-03 18:07:10 +02:00
parent 880ea93424
commit 15997bd5af
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 10 additions and 10 deletions

View File

@ -42,11 +42,11 @@ urlpatterns = [
{"template": "list_sessions.html#session-row"},
name="list_sessions_end_session",
),
# path(
# "session/<int:session_id>/delete",
# views.delete_session,
# name="delete_session",
# ),
path(
"session/<int:session_id>/delete",
views.delete_session,
name="delete_session",
),
path(
"purchase/<int:purchase_id>/delete",
views.delete_purchase,

View File

@ -283,11 +283,11 @@ def end_session(request, session_id: int, template: str = ""):
return render(request, template, context)
return redirect("list_sessions")
# def delete_session(request, session_id=None):
# session = Session.objects.get(id=session_id)
# session.delete()
# return redirect("list_sessions")
@login_required
def delete_session(request, session_id=None):
session = get_object_or_404(Session, id=session_id)
session.delete()
return redirect("list_sessions")
@login_required