Re-introduce index view

This commit is contained in:
Lukáš Kucharczyk 2023-02-18 20:50:36 +01:00
parent b0b3567bf3
commit d447302b46
2 changed files with 14 additions and 4 deletions

View File

@ -3,7 +3,13 @@ from django.urls import path
from games import views
urlpatterns = [
path("", views.list_sessions, {"filter": "recent"}, name="list_sessions_recent"),
path("", views.index, name="index"),
path(
"list-sessions/recent",
views.list_sessions,
{"filter": "recent"},
name="list_sessions_recent",
),
path("add-game/", views.add_game, name="add_game"),
path("add-platform/", views.add_platform, name="add_platform"),
path("add-session/", views.add_session, name="add_session"),

View File

@ -117,7 +117,7 @@ def add_purchase(request):
form = PurchaseForm(request.POST or None, initial=initial)
if form.is_valid():
form.save()
return redirect("list_sessions")
return redirect("index")
context["form"] = form
context["title"] = "Add New Purchase"
@ -129,7 +129,7 @@ def add_game(request):
form = GameForm(request.POST or None)
if form.is_valid():
form.save()
return redirect("list_sessions")
return redirect("index")
context["form"] = form
context["title"] = "Add New Game"
@ -153,8 +153,12 @@ def add_platform(request):
form = PlatformForm(request.POST or None)
if form.is_valid():
form.save()
return redirect("list_sessions")
return redirect("index")
context["form"] = form
context["title"] = "Add New Platform"
return render(request, "add.html", context)
def index(request):
return redirect("list_sessions_recent")