mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-03-28 09:39:28 -04:00
- Refactored park detail template from HTMX/Alpine.js to Django Unicorn component
- Achieved ~97% reduction in template complexity
- Created ParkDetailView component with optimized data loading and reactive features
- Developed a responsive reactive template for park details
- Implemented server-side state management and reactive event handlers
- Enhanced performance with optimized database queries and loading states
- Comprehensive error handling and user experience improvements
docs: Update Django Unicorn refactoring plan with completed components and phases
- Documented installation and configuration of Django Unicorn
- Detailed completed work on park search component and refactoring strategy
- Outlined planned refactoring phases for future components
- Provided examples of component structure and usage
feat: Implement parks rides endpoint with comprehensive features
- Developed API endpoint GET /api/v1/parks/{park_slug}/rides/ for paginated ride listings
- Included filtering capabilities for categories and statuses
- Optimized database queries with select_related and prefetch_related
- Implemented serializer for comprehensive ride data output
- Added complete API documentation for frontend integration
64 lines
2.4 KiB
Python
64 lines
2.4 KiB
Python
"""Comprehensive URL routes for Parks domain (API v1).
|
|
|
|
This file exposes a maximal set of "full-fat" endpoints implemented in
|
|
`apps.api.v1.parks.park_views` and `apps.api.v1.parks.views`. Endpoints are
|
|
intentionally expansive to match the rides API functionality and provide
|
|
complete feature parity for parks management.
|
|
"""
|
|
|
|
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .park_views import (
|
|
ParkListCreateAPIView,
|
|
ParkDetailAPIView,
|
|
FilterOptionsAPIView,
|
|
CompanySearchAPIView,
|
|
ParkSearchSuggestionsAPIView,
|
|
ParkImageSettingsAPIView,
|
|
)
|
|
from .park_rides_views import ParkRidesListAPIView, ParkRideDetailAPIView, ParkDetailAPIView as ParkComprehensiveDetailAPIView
|
|
from .views import ParkPhotoViewSet
|
|
|
|
# Create router for nested photo endpoints
|
|
router = DefaultRouter()
|
|
router.register(r"", ParkPhotoViewSet, basename="park-photo")
|
|
|
|
app_name = "api_v1_parks"
|
|
|
|
urlpatterns = [
|
|
# Core list/create endpoints
|
|
path("", ParkListCreateAPIView.as_view(), name="park-list-create"),
|
|
# Filter options
|
|
path("filter-options/", FilterOptionsAPIView.as_view(), name="park-filter-options"),
|
|
# Autocomplete / suggestion endpoints
|
|
path(
|
|
"search/companies/",
|
|
CompanySearchAPIView.as_view(),
|
|
name="park-search-companies",
|
|
),
|
|
path(
|
|
"search-suggestions/",
|
|
ParkSearchSuggestionsAPIView.as_view(),
|
|
name="park-search-suggestions",
|
|
),
|
|
# Detail and action endpoints - supports both ID and slug
|
|
path("<str:pk>/", ParkDetailAPIView.as_view(), name="park-detail"),
|
|
# Park rides endpoint - list rides at a specific park
|
|
path("<str:park_slug>/rides/", ParkRidesListAPIView.as_view(), name="park-rides-list"),
|
|
# Park ride detail endpoint - get comprehensive details for a specific ride at a park
|
|
path("<str:park_slug>/rides/<str:ride_slug>/",
|
|
ParkRideDetailAPIView.as_view(), name="park-ride-detail"),
|
|
# Park comprehensive detail endpoint - get all possible detail about a park
|
|
path("<str:park_slug>/detail/", ParkComprehensiveDetailAPIView.as_view(),
|
|
name="park-comprehensive-detail"),
|
|
# Park image settings endpoint
|
|
path(
|
|
"<int:pk>/image-settings/",
|
|
ParkImageSettingsAPIView.as_view(),
|
|
name="park-image-settings",
|
|
),
|
|
# Park photo endpoints - domain-specific photo management
|
|
path("<int:park_pk>/photos/", include(router.urls)),
|
|
]
|