From 9c7755d8b6de308581277fe9ca5c551cc9464f5a Mon Sep 17 00:00:00 2001 From: mortezaei Date: Mon, 1 Dec 2025 16:46:26 +0330 Subject: [PATCH] refactor(podcast, video): update URL patterns to use re_path for slug-based detail views - Changed detail endpoints in podcast and video URL configurations to use re_path for improved regex matching of slugs. - This change enhances flexibility in slug handling and maintains consistency across the application.rl --- apps/podcast/urls.py | 6 +++--- apps/video/urls.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/podcast/urls.py b/apps/podcast/urls.py index adc7a93..6a45e13 100755 --- a/apps/podcast/urls.py +++ b/apps/podcast/urls.py @@ -1,4 +1,4 @@ -from django.urls import path +from django.urls import path, re_path from .views import * app_name = 'podcast' @@ -9,8 +9,8 @@ urlpatterns = [ path('collections/', MiddlePodcastCollectionListView.as_view(), name='collection-list'), path('list/', PodcastListAPIView.as_view(), name='podcast-list'), - path('detail//', PodcastDetailAPIView.as_view(), name='podcast-detail'), - + re_path(r'detail/(?P[\w-]+)/$', PodcastDetailAPIView.as_view(), name='podcast-detail'), + # User playlist endpoints path('user-playlist/', UserPlaylistCreateAPIView.as_view(), name='user-playlist-create'), path('user-playlist/list/', UserPlaylistListAPIView.as_view(), name='user-playlist-list'), diff --git a/apps/video/urls.py b/apps/video/urls.py index 626349e..f00325b 100755 --- a/apps/video/urls.py +++ b/apps/video/urls.py @@ -1,4 +1,4 @@ -from django.urls import path +from django.urls import path, re_path from .views import * app_name = 'video' @@ -9,9 +9,9 @@ urlpatterns = [ path('collections/', MiddleVideoCollectionListView.as_view(), name='collection-list'), path('playlists/', VideoPlaylistListAPIView.as_view(), name='playlist-list'), - path('playlists//', VideoPlaylistDetailAPIView.as_view(), name='playlist-detail'), - + re_path(r'playlists/(?P[\w-]+)/$', VideoPlaylistDetailAPIView.as_view(), name='playlist-detail'), + # Keep old video endpoints for backward compatibility if needed path('list/', VideoPlaylistListAPIView.as_view(), name='video-list'), - path('detail//', VideoPlaylistDetailAPIView.as_view(), name='video-detail'), + re_path(r'detail/(?P[\w-]+)/$', VideoPlaylistDetailAPIView.as_view(), name='video-detail'), ] \ No newline at end of file