diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1349845..3b5a1b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
## Unreleased
+* Allow editing filtered entities from session list
* Add wikidata ID and year for editions
* Allow filtering by game, edition, purchase from the session list
* Add icons for the above
diff --git a/games/templates/list_sessions.html b/games/templates/list_sessions.html
index cf9ee44..0411611 100644
--- a/games/templates/list_sessions.html
+++ b/games/templates/list_sessions.html
@@ -18,7 +18,22 @@
- Filtering by "{% firstof purchase platform game edition ownership_type %}"
+
+ {% if purchase %}
+ Filtering by purchase "{{ purchase }}"
+ (Edit)
+ {% elif platform %}
+ Filtering by purchase "{{ platform }}"
+ (Edit)
+ {% elif game %}
+ Filtering by purchase "{{ game }}"
+ (Edit)
+ {% elif edition %}
+ Filtering by purchase "{{ edition }}"
+ (Edit)
+ {% elif ownership_type %}
+ Filtering by ownership type "{{ ownership_type }}"
+ {% endif%}
{% if purchase %}See all platforms{% endif %}
{% endif %}
diff --git a/games/urls.py b/games/urls.py
index fbf626c..08c8656 100644
--- a/games/urls.py
+++ b/games/urls.py
@@ -31,6 +31,8 @@ urlpatterns = [
path("add-purchase/", views.add_purchase, name="add_purchase"),
path("add-edition/", views.add_edition, name="add_edition"),
path("edit-edition/", views.edit_edition, name="edit_edition"),
+ path("edit-game/", views.edit_game, name="edit_game"),
+ path("edit-platform/", views.edit_platform, name="edit_platform"),
path("add-device/", views.add_device, name="add_device"),
path("edit-session/", views.edit_session, name="edit_session"),
path("edit-purchase/", views.edit_purchase, name="edit_purchase"),
diff --git a/games/views.py b/games/views.py
index a11e5f9..c09d42f 100644
--- a/games/views.py
+++ b/games/views.py
@@ -79,6 +79,30 @@ def edit_purchase(request, purchase_id=None):
return render(request, "add.html", context)
+def edit_game(request, game_id=None):
+ context = {}
+ purchase = Game.objects.get(id=game_id)
+ form = GameForm(request.POST or None, instance=purchase)
+ if form.is_valid():
+ form.save()
+ return redirect("list_sessions")
+ context["title"] = "Edit Game"
+ context["form"] = form
+ return render(request, "add.html", context)
+
+
+def edit_platform(request, platform_id=None):
+ context = {}
+ purchase = Platform.objects.get(id=platform_id)
+ form = PlatformForm(request.POST or None, instance=purchase)
+ if form.is_valid():
+ form.save()
+ return redirect("list_sessions")
+ context["title"] = "Edit Platform"
+ context["form"] = form
+ return render(request, "add.html", context)
+
+
def edit_edition(request, edition_id=None):
context = {}
edition = Edition.objects.get(id=edition_id)