Re-introduce index view
This commit is contained in:
parent
b0b3567bf3
commit
d447302b46
|
@ -3,7 +3,13 @@ from django.urls import path
|
||||||
from games import views
|
from games import views
|
||||||
|
|
||||||
urlpatterns = [
|
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-game/", views.add_game, name="add_game"),
|
||||||
path("add-platform/", views.add_platform, name="add_platform"),
|
path("add-platform/", views.add_platform, name="add_platform"),
|
||||||
path("add-session/", views.add_session, name="add_session"),
|
path("add-session/", views.add_session, name="add_session"),
|
||||||
|
|
|
@ -117,7 +117,7 @@ def add_purchase(request):
|
||||||
form = PurchaseForm(request.POST or None, initial=initial)
|
form = PurchaseForm(request.POST or None, initial=initial)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
return redirect("list_sessions")
|
return redirect("index")
|
||||||
|
|
||||||
context["form"] = form
|
context["form"] = form
|
||||||
context["title"] = "Add New Purchase"
|
context["title"] = "Add New Purchase"
|
||||||
|
@ -129,7 +129,7 @@ def add_game(request):
|
||||||
form = GameForm(request.POST or None)
|
form = GameForm(request.POST or None)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
return redirect("list_sessions")
|
return redirect("index")
|
||||||
|
|
||||||
context["form"] = form
|
context["form"] = form
|
||||||
context["title"] = "Add New Game"
|
context["title"] = "Add New Game"
|
||||||
|
@ -153,8 +153,12 @@ def add_platform(request):
|
||||||
form = PlatformForm(request.POST or None)
|
form = PlatformForm(request.POST or None)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
return redirect("list_sessions")
|
return redirect("index")
|
||||||
|
|
||||||
context["form"] = form
|
context["form"] = form
|
||||||
context["title"] = "Add New Platform"
|
context["title"] = "Add New Platform"
|
||||||
return render(request, "add.html", context)
|
return render(request, "add.html", context)
|
||||||
|
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
return redirect("list_sessions_recent")
|
||||||
|
|
Loading…
Reference in New Issue