diff --git a/games/templates/cotton/icon/eject.html b/games/templates/cotton/icon/eject.html
new file mode 100644
index 0000000..fac0832
--- /dev/null
+++ b/games/templates/cotton/icon/eject.html
@@ -0,0 +1,8 @@
+
diff --git a/games/urls.py b/games/urls.py
index 97565cd..fab22c6 100644
--- a/games/urls.py
+++ b/games/urls.py
@@ -44,6 +44,11 @@ urlpatterns = [
purchase.edit_purchase,
name="edit_purchase",
),
+ path(
+ "purchase//drop",
+ purchase.drop_purchase,
+ name="drop_purchase",
+ ),
path(
"purchase//delete",
purchase.delete_purchase,
diff --git a/games/views/purchase.py b/games/views/purchase.py
index a353227..7209d79 100644
--- a/games/views/purchase.py
+++ b/games/views/purchase.py
@@ -103,6 +103,15 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
"cotton/button_group.html",
{
"buttons": [
+ {
+ "href": reverse(
+ "drop_purchase", args=[purchase.pk]
+ ),
+ "slot": Icon("eject"),
+ "title": "Mark as dropped",
+ }
+ if not purchase.date_dropped
+ else {},
{
"href": reverse(
"edit_purchase", args=[purchase.pk]
@@ -189,6 +198,14 @@ def delete_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
return redirect("list_sessions")
+@login_required
+def drop_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
+ purchase = get_object_or_404(Purchase, id=purchase_id)
+ purchase.date_dropped = timezone.now()
+ purchase.save()
+ return redirect("list_sessions")
+
+
def related_purchase_by_edition(request: HttpRequest) -> HttpResponse:
edition_id = request.GET.get("edition")
if not edition_id: