19 lines
589 B
Python
19 lines
589 B
Python
# blog/urls.py
|
|
from django.urls import path, register_converter
|
|
from . import views
|
|
from .converters import UnicodeSlugConverter
|
|
|
|
register_converter(UnicodeSlugConverter, 'unislug')
|
|
|
|
app_name = 'blog'
|
|
|
|
urlpatterns = [
|
|
path('', views.category_list, name='category_list'),
|
|
|
|
# ✅ 用 unislug 替代 slug
|
|
path('category/<unislug:slug>/', views.category_detail, name='category_detail'),
|
|
|
|
path('post/<slug:slug>/', views.post_detail, name='post_detail'),
|
|
path('tag/<unislug:slug>/', views.tag_detail, name='tag_detail'),
|
|
path('about/', views.about_page, name='about'),
|
|
] |