You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
from django.urls import path, re_path , include
|
|
from rest_framework.routers import DefaultRouter, SimpleRouter
|
|
|
|
from .views import BlogListAPIView, RelatedBlogsAPIView, BlogDetailBySlugAPIView
|
|
|
|
from .views_admin import AdminBlogViewSet, AdminBlogContentViewSet, AdminBlogSeoViewSet
|
|
|
|
app_name = 'blog'
|
|
|
|
# --- Admin Router Setup ---
|
|
admin_router = SimpleRouter()
|
|
admin_router.register(r'blogs', AdminBlogViewSet, basename='admin-blogs')
|
|
admin_router.register(r'contents', AdminBlogContentViewSet, basename='admin-blog-contents')
|
|
admin_router.register(r'seo', AdminBlogSeoViewSet, basename='admin-blog-seo')
|
|
|
|
urlpatterns = [
|
|
# Blog list with search and sort_by filters
|
|
path('list/', BlogListAPIView.as_view(), name='blog-list'),
|
|
|
|
# Related blogs for a specific blog ID
|
|
path('related/<int:blog_id>/', RelatedBlogsAPIView.as_view(), name='related-blogs'),
|
|
|
|
# Blog detail by slug (using regex to support different languages)
|
|
re_path(r'^detail/(?P<slug>[\w\-\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u200C\u200D]+)/$',
|
|
BlogDetailBySlugAPIView.as_view(),
|
|
name='blog-detail'),
|
|
|
|
path('admin/', include(admin_router.urls)),
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|