Files
msa-django-blog/blog/urls.py
icurfer dfecaa7654
All checks were successful
Build And Test / build-and-push (push) Successful in 2m5s
feat: Attachment 모델 추가 및 관련 기능 구현
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 23:39:05 +09:00

40 lines
1.4 KiB
Python

# blog/urls.py
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
PostListView, PostListCreateView, PostDetailView,
CommentViewSet, TagListView,
AttachmentListCreateView, AttachmentDeleteView,
TempAttachmentUploadView, TempAttachmentDeleteView
)
# 댓글 라우터
comment_router = DefaultRouter()
comment_router.register(r'comments', CommentViewSet, basename='comment')
urlpatterns = [
# 태그 관련
path('tags/', TagListView.as_view(), name='tag-list'),
# 포스트 관련
path('posts/', PostListView.as_view(), name='post-list'),
path('create/', PostListCreateView.as_view(), name='post-list-create'),
path('posts/<int:pk>/', PostDetailView.as_view(), name='post-detail'),
# 댓글 관련 (포스트 하위 리소스)
path('posts/<int:post_pk>/', include(comment_router.urls)),
# 첨부파일 관련
path('posts/<int:post_pk>/attachments/',
AttachmentListCreateView.as_view(), name='attachment-list'),
path('posts/<int:post_pk>/attachments/<int:pk>/',
AttachmentDeleteView.as_view(), name='attachment-delete'),
# 임시 첨부파일 (게시글 작성 전 업로드)
path('attachments/upload/',
TempAttachmentUploadView.as_view(), name='temp-attachment-upload'),
path('attachments/<int:pk>/',
TempAttachmentDeleteView.as_view(), name='temp-attachment-delete'),
]