diff --git a/cards/forms.py b/cards/forms.py
index 296dbe3..c1c67c0 100644
--- a/cards/forms.py
+++ b/cards/forms.py
@@ -39,3 +39,22 @@ class BackgroundImageForm(forms.ModelForm):
'image': forms.ClearableFileInput(attrs={'class': 'file-input'}),
'is_active': forms.CheckboxInput(attrs={'class': 'checkbox'}),
}
+
+
+from django.forms import modelformset_factory
+
+# A simplified form used in the bulk edit table (only a few editable fields)
+class DinosaurBulkForm(forms.ModelForm):
+ class Meta:
+ model = Dinosaur
+ fields = ['name', 'background', 'speed', 'weight', 'height', 'intelligence']
+ widgets = {
+ 'name': forms.TextInput(attrs={'class': 'input'}),
+ 'background': forms.Select(attrs={'class': 'input'}),
+ 'speed': forms.NumberInput(attrs={'class': 'input', 'min': 0}),
+ 'weight': forms.NumberInput(attrs={'class': 'input', 'min': 0}),
+ 'height': forms.NumberInput(attrs={'class': 'input', 'step': '0.1'}),
+ 'intelligence': forms.NumberInput(attrs={'class': 'input', 'min': 0, 'max': 100}),
+ }
+
+DinosaurBulkFormSet = modelformset_factory(Dinosaur, form=DinosaurBulkForm, extra=0)
diff --git a/cards/templates/cards/base.html b/cards/templates/cards/base.html
index 8238fe9..691f6ee 100644
--- a/cards/templates/cards/base.html
+++ b/cards/templates/cards/base.html
@@ -63,6 +63,9 @@
.background-picker .bg-option img{width:100%;height:100%;object-fit:cover;display:block;border-radius:2px}
.background-picker .bg-option.selected{outline:2px solid var(--accent);box-shadow:0 2px 6px rgba(0,0,0,0.08)}
.background-picker .bg-option[role="button"]{font-size:0.8rem;padding:6px 8px}
+ /* Bulk edit thumbnails */
+ .bulk-thumb{width:48px;height:48px;object-fit:cover;border-radius:6px;border:1px solid rgba(0,0,0,0.06);display:inline-block}
+ .bulk-thumb.empty{background:rgba(0,0,0,0.04);width:48px;height:48px;border-radius:6px}
.toptrump-card .title-band{background:var(--accent);color:#072027;padding:0.6rem 0.75rem;text-align:center;font-weight:700;font-size:1.05rem}
.toptrump-card .card-body{padding:0.75rem}
.toptrump-card .stat-row{display:flex;align-items:center;gap:0.75rem;padding:0.25rem 0}
diff --git a/cards/templates/cards/bulk_edit.html b/cards/templates/cards/bulk_edit.html
new file mode 100644
index 0000000..dadc6ba
--- /dev/null
+++ b/cards/templates/cards/bulk_edit.html
@@ -0,0 +1,84 @@
+{% extends "cards/base.html" %}
+
+{% block content %}
+
+
+
Cards overview — bulk edit
+
Edit multiple cards inline and save changes in one go.
+
+
+
+
+{% endblock %}
diff --git a/cards/templates/cards/list.html b/cards/templates/cards/list.html
index b297575..22eb8c9 100644
--- a/cards/templates/cards/list.html
+++ b/cards/templates/cards/list.html
@@ -9,6 +9,9 @@
+
diff --git a/cards/urls.py b/cards/urls.py
index f91615e..d74a488 100644
--- a/cards/urls.py
+++ b/cards/urls.py
@@ -13,4 +13,6 @@ urlpatterns = [
path('backgrounds/create/', views.background_create, name='background_create'),
path('backgrounds//activate/', views.background_activate, name='background_activate'),
path('backgrounds//delete/', views.background_delete, name='background_delete'),
+ path('overview/', views.cards_overview, name='overview'),
+ path('overview/bulk-update/', views.cards_bulk_update, name='overview_bulk_update'),
]
diff --git a/cards/views.py b/cards/views.py
index 70da221..b9e3946 100644
--- a/cards/views.py
+++ b/cards/views.py
@@ -2,6 +2,7 @@ from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse, HttpResponseBadRequest
from django.template.loader import render_to_string
from .models import Dinosaur, BackgroundImage
+from .forms import DinosaurBulkFormSet
from .forms import DinosaurForm
from .forms import BackgroundImageForm
@@ -143,3 +144,28 @@ def preview_card(request, pk):
if is_htmx(request):
return render(request, 'cards/_card_preview.html', {'card': card, 'background': background})
return render(request, 'cards/preview.html', {'card': card, 'background': background})
+
+
+def cards_overview(request):
+ """Overview page showing all cards in a table for quick edits."""
+ backgrounds = BackgroundImage.objects.all()
+ qs = Dinosaur.objects.order_by('name')
+ formset = None
+ return render(request, 'cards/bulk_edit.html', {'cards': qs, 'backgrounds': backgrounds})
+
+
+def cards_bulk_update(request):
+ """Handle POST from the bulk edit formset and save changes."""
+ if request.method != 'POST':
+ return HttpResponseBadRequest('Only POST allowed')
+ formset = None
+ try:
+ formset = DinosaurBulkFormSet(request.POST)
+ except Exception:
+ return HttpResponseBadRequest('Invalid submission')
+ if formset.is_valid():
+ formset.save()
+ return redirect('cards:overview')
+ # If invalid, re-render the overview with errors
+ backgrounds = BackgroundImage.objects.all()
+ return render(request, 'cards/bulk_edit.html', {'formset': formset, 'backgrounds': backgrounds})
diff --git a/templates/cards/base.html b/templates/cards/base.html
index 05d65a0..c12564e 100644
--- a/templates/cards/base.html
+++ b/templates/cards/base.html
@@ -56,6 +56,9 @@
.background-picker .bg-option img{max-width:100%;max-height:100%;display:block;border-radius:2px}
.background-picker .bg-option.selected{outline:2px solid var(--accent);box-shadow:0 2px 6px rgba(0,0,0,0.08)}
.background-picker .bg-option[role="button"]{font-size:0.8rem;padding:6px 8px}
+ /* Bulk edit thumbnails */
+ .bulk-thumb{width:48px;height:48px;object-fit:cover;border-radius:6px;border:1px solid rgba(0,0,0,0.06);display:inline-block}
+ .bulk-thumb.empty{background:rgba(0,0,0,0.04);width:48px;height:48px;border-radius:6px}
.toptrump-card .title-band{background:var(--accent);color:#072027;padding:0.6rem 0.75rem;text-align:center;font-weight:700;font-size:1.05rem}
.toptrump-card .card-body{padding:0.75rem}
.toptrump-card .stat-row{display:flex;align-items:center;gap:0.75rem;padding:0.25rem 0}
diff --git a/templates/cards/bulk_edit.html b/templates/cards/bulk_edit.html
new file mode 100644
index 0000000..dadc6ba
--- /dev/null
+++ b/templates/cards/bulk_edit.html
@@ -0,0 +1,84 @@
+{% extends "cards/base.html" %}
+
+{% block content %}
+
+
+
Cards overview — bulk edit
+
Edit multiple cards inline and save changes in one go.
+
+
+
+
+{% endblock %}
diff --git a/templates/cards/list.html b/templates/cards/list.html
index b297575..22eb8c9 100644
--- a/templates/cards/list.html
+++ b/templates/cards/list.html
@@ -9,6 +9,9 @@
+