delete platform
Django CI/CD / test (push) Successful in 51s Details
Django CI/CD / build-and-push (push) Has been skipped Details

This commit is contained in:
Lukáš Kucharczyk 2024-08-11 20:21:44 +02:00
parent 3099f02145
commit b28c42d945
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,6 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse
from games.forms import PlatformForm
from games.models import Platform
from games.views import dateformat
@ -74,3 +73,8 @@ def list_platforms(request: HttpRequest) -> HttpResponse:
return render(request, "list_purchases.html", context)
@login_required
def delete_platform(request: HttpRequest, platform_id: int) -> HttpResponse:
platform = get_object_or_404(Platform, id=platform_id)
platform.delete()
return redirect("list_platforms")