diff --git a/games/views/session.py b/games/views/session.py index b67fcf8..984dfec 100644 --- a/games/views/session.py +++ b/games/views/session.py @@ -3,7 +3,7 @@ from typing import Any from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator from django.db.models import Q -from django.http import HttpRequest, HttpResponse +from django.http import HttpRequest, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect, render from django.template.loader import render_to_string from django.urls import reverse @@ -26,7 +26,6 @@ from common.time import ( from common.utils import truncate from games.forms import SessionForm from games.models import Game, Session -from games.views.general import use_custom_redirect @login_required @@ -215,14 +214,13 @@ def add_session(request: HttpRequest, game_id: int = 0) -> HttpResponse: @login_required -@use_custom_redirect def edit_session(request: HttpRequest, session_id: int) -> HttpResponse: context = {} session = get_object_or_404(Session, id=session_id) form = SessionForm(request.POST or None, instance=session) if form.is_valid(): form.save() - return redirect("list_sessions") + return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/")) context["title"] = "Edit Session" context["form"] = form return render(request, "add.html", context)