Browse Source

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
master
mortezaei 6 months ago
parent
commit
9c7755d8b6
  1. 6
      apps/podcast/urls.py
  2. 8
      apps/video/urls.py

6
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/<slug:slug>/', PodcastDetailAPIView.as_view(), name='podcast-detail'),
re_path(r'detail/(?P<slug>[\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'),

8
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/<slug:slug>/', VideoPlaylistDetailAPIView.as_view(), name='playlist-detail'),
re_path(r'playlists/(?P<slug>[\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/<slug:slug>/', VideoPlaylistDetailAPIView.as_view(), name='video-detail'),
re_path(r'detail/(?P<slug>[\w-]+)/$', VideoPlaylistDetailAPIView.as_view(), name='video-detail'),
]
Loading…
Cancel
Save