mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 13:11:08 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
66 lines
1.8 KiB
Python
66 lines
1.8 KiB
Python
"""
|
|
URL configuration for Parks API following Django styleguide patterns.
|
|
"""
|
|
|
|
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .views import (
|
|
ParkListApi,
|
|
ParkDetailApi,
|
|
ParkCreateApi,
|
|
ParkUpdateApi,
|
|
ParkDeleteApi,
|
|
ParkApi,
|
|
)
|
|
|
|
app_name = "parks_api"
|
|
|
|
# Option 1: Separate ViewSets for each operation (more explicit)
|
|
router_separate = DefaultRouter()
|
|
router_separate.register(r"list", ParkListApi, basename="park-list")
|
|
router_separate.register(r"detail", ParkDetailApi, basename="park-detail")
|
|
router_separate.register(r"create", ParkCreateApi, basename="park-create")
|
|
router_separate.register(r"update", ParkUpdateApi, basename="park-update")
|
|
router_separate.register(r"delete", ParkDeleteApi, basename="park-delete")
|
|
|
|
# Option 2: Unified ViewSet (more conventional DRF)
|
|
router_unified = DefaultRouter()
|
|
router_unified.register(r"parks", ParkApi, basename="park")
|
|
|
|
# Use unified approach for cleaner URLs
|
|
urlpatterns = [
|
|
path("v1/", include(router_unified.urls)),
|
|
]
|
|
|
|
# Alternative manual URL patterns for more control
|
|
urlpatterns_manual = [
|
|
# List and create
|
|
path(
|
|
"v1/parks/",
|
|
ParkApi.as_view({"get": "list", "post": "create"}),
|
|
name="park-list",
|
|
),
|
|
# Stats endpoint
|
|
path("v1/parks/stats/", ParkApi.as_view({"get": "stats"}), name="park-stats"),
|
|
# Detail operations
|
|
path(
|
|
"v1/parks/<slug:slug>/",
|
|
ParkApi.as_view(
|
|
{
|
|
"get": "retrieve",
|
|
"put": "update",
|
|
"patch": "partial_update",
|
|
"delete": "destroy",
|
|
}
|
|
),
|
|
name="park-detail",
|
|
),
|
|
# Park reviews
|
|
path(
|
|
"v1/parks/<slug:slug>/reviews/",
|
|
ParkApi.as_view({"get": "reviews"}),
|
|
name="park-reviews",
|
|
),
|
|
]
|