add table header actions
All checks were successful
Django CI/CD / test (push) Successful in 1m3s
Django CI/CD / build-and-push (push) Successful in 2m23s

This commit is contained in:
2024-09-08 21:03:37 +02:00
parent c1b3493c80
commit 58cfaca1a9
23 changed files with 645 additions and 244 deletions

View File

@ -13,8 +13,9 @@ from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
from common.time import dateformat, local_strftime
from common.utils import A, Button, truncate_with_popover
from common.components import A, Button, Icon
from common.time import dateformat
from common.utils import truncate_with_popover
from games.forms import PurchaseForm
from games.models import Edition, Purchase
from games.views.general import use_custom_redirect
@ -81,39 +82,39 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
purchase.price,
purchase.price_currency,
purchase.infinite,
local_strftime(purchase.date_purchased, dateformat),
purchase.date_purchased.strftime(dateformat),
(
local_strftime(purchase.date_refunded, dateformat)
purchase.date_refunded.strftime(dateformat)
if purchase.date_refunded
else "-"
),
(
local_strftime(purchase.date_finished, dateformat)
purchase.date_finished.strftime(dateformat)
if purchase.date_finished
else "-"
),
(
local_strftime(purchase.date_dropped, dateformat)
purchase.date_dropped.strftime(dateformat)
if purchase.date_dropped
else "-"
),
local_strftime(purchase.created_at, dateformat),
purchase.created_at.strftime(dateformat),
render_to_string(
"cotton/button_group_sm.html",
"cotton/button_group.html",
{
"buttons": [
{
"href": reverse(
"edit_purchase", args=[purchase.pk]
),
"text": "Edit",
"slot": Icon("edit"),
"color": "gray",
},
{
"href": reverse(
"delete_purchase", args=[purchase.pk]
),
"text": "Delete",
"slot": Icon("delete"),
"color": "red",
},
]