-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Trey <[email protected]>
- Loading branch information
Showing
2 changed files
with
1 addition
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
from typing import Literal | ||
|
||
from django.contrib import messages | ||
from django.http.response import HttpResponse | ||
from django.shortcuts import render | ||
from django.contrib.auth.decorators import login_required | ||
from django.views.decorators.http import require_http_methods | ||
|
||
from backend.models import Client | ||
from backend.service.clients.delete import delete_client | ||
from backend.types.htmx import HtmxHttpRequest | ||
|
||
|
||
@require_http_methods(["DELETE"]) | ||
@login_required | ||
def client_delete(request: HtmxHttpRequest, id: int): | ||
response: str | Literal[True] = delete_client(request, id) | ||
|
||
if isinstance(response, str): | ||
messages.error(request, response) | ||
else: | ||
messages.success(request, f"Successfully deleted client #{id}") | ||
|
||
return render(request, "base/toast.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters