diff --git a/radiofeed/podcasts/views.py b/radiofeed/podcasts/views.py index 150ca6aba..0d97131c3 100644 --- a/radiofeed/podcasts/views.py +++ b/radiofeed/podcasts/views.py @@ -1,4 +1,4 @@ -from typing import Final, cast +from typing import cast from django.conf import settings from django.contrib import messages @@ -8,7 +8,7 @@ from django.http import Http404, HttpRequest, HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.template.response import TemplateResponse -from django.urls import reverse_lazy +from django.urls import reverse from django.views.decorators.http import require_POST, require_safe from radiofeed.http import HttpResponseConflict, require_DELETE, require_form_methods @@ -20,9 +20,6 @@ from radiofeed.podcasts.models import Category, Podcast from radiofeed.users.models import User -_discover_url: Final = reverse_lazy("podcasts:discover") -_private_feeds_url: Final = reverse_lazy("podcasts:private_feeds") - @require_safe @login_required @@ -84,7 +81,7 @@ def search_podcasts( return render_pagination(request, "podcasts/search_podcasts.html", podcasts) - return HttpResponseRedirect(_discover_url) + return HttpResponseRedirect(reverse("podcasts:discover")) @require_safe @@ -107,7 +104,7 @@ def search_itunes(request: HttpRequest) -> HttpResponseRedirect | TemplateRespon }, ) - return HttpResponseRedirect(_discover_url) + return HttpResponseRedirect(reverse("podcasts:discover")) @require_safe @@ -322,7 +319,8 @@ def add_private_feed( request, "Podcast added to your Private Feeds and will appear here soon", ) - return HttpResponseRedirect(_private_feeds_url) + + return HttpResponseRedirect(reverse("podcasts:private_feeds")) messages.success(request, "Podcast added to your Private Feeds") return HttpResponseRedirect(podcast.get_absolute_url()) @@ -347,7 +345,7 @@ def remove_private_feed(request: HttpRequest, podcast_id: int) -> HttpResponseRe podcast = _get_podcast_or_404(podcast_id, private=True) request.user.subscriptions.filter(podcast=podcast).delete() messages.info(request, "Removed from Private Feeds") - return HttpResponseRedirect(_private_feeds_url) + return HttpResponseRedirect(reverse("podcasts:private_feeds")) def _get_podcasts() -> QuerySet[Podcast]: