mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:11:09 -05:00
Introduce autocomplete for park searches, optimize park data fetching with select_related and prefetch_related, add new API endpoints for autocomplete and quick filters, and refactor the park list view to use new Django Cotton components for a more dynamic and user-friendly experience. Replit-Commit-Author: Agent Replit-Commit-Session-Id: c446bc9e-66df-438c-a86c-f53e6da13649 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
113 lines
3.8 KiB
Python
113 lines
3.8 KiB
Python
from django.urls import path, include
|
|
from . import views, views_search, views_autocomplete
|
|
from apps.rides.views import ParkSingleCategoryListView
|
|
from .views_roadtrip import (
|
|
RoadTripPlannerView,
|
|
CreateTripView,
|
|
TripDetailView,
|
|
FindParksAlongRouteView,
|
|
GeocodeAddressView,
|
|
ParkDistanceCalculatorView,
|
|
)
|
|
|
|
app_name = "parks"
|
|
|
|
urlpatterns = [
|
|
# Park views with autocomplete search
|
|
path("", views.ParkListView.as_view(), name="park_list"),
|
|
path("operators/", views.OperatorListView.as_view(), name="operator_list"),
|
|
path("create/", views.ParkCreateView.as_view(), name="park_create"),
|
|
# Add park button endpoint (moved before park detail pattern)
|
|
path("add-park-button/", views.add_park_button, name="add_park_button"),
|
|
# Location search endpoints
|
|
path("search/location/", views.location_search, name="location_search"),
|
|
path(
|
|
"search/reverse-geocode/",
|
|
views.reverse_geocode,
|
|
name="reverse_geocode",
|
|
),
|
|
# Areas and search endpoints for HTMX
|
|
path("areas/", views.get_park_areas, name="get_park_areas"),
|
|
path("suggest_parks/", views_search.suggest_parks, name="suggest_parks"),
|
|
path("search/", views.search_parks, name="search_parks"),
|
|
# Enhanced search endpoints
|
|
path("api/autocomplete/", views_autocomplete.ParkAutocompleteView.as_view(), name="park_autocomplete"),
|
|
path("api/quick-filters/", views_autocomplete.QuickFilterSuggestionsView.as_view(), name="quick_filter_suggestions"),
|
|
# Road trip planning URLs
|
|
path("roadtrip/", RoadTripPlannerView.as_view(), name="roadtrip_planner"),
|
|
path("roadtrip/create/", CreateTripView.as_view(), name="roadtrip_create"),
|
|
path(
|
|
"roadtrip/<str:trip_id>/",
|
|
TripDetailView.as_view(),
|
|
name="roadtrip_detail",
|
|
),
|
|
# Road trip HTMX endpoints
|
|
path(
|
|
"roadtrip/htmx/parks-along-route/",
|
|
FindParksAlongRouteView.as_view(),
|
|
name="roadtrip_htmx_parks_along_route",
|
|
),
|
|
path(
|
|
"roadtrip/htmx/geocode/",
|
|
GeocodeAddressView.as_view(),
|
|
name="roadtrip_htmx_geocode",
|
|
),
|
|
path(
|
|
"roadtrip/htmx/distance/",
|
|
ParkDistanceCalculatorView.as_view(),
|
|
name="roadtrip_htmx_distance",
|
|
),
|
|
# Park detail and related views
|
|
path("<slug:slug>/", views.ParkDetailView.as_view(), name="park_detail"),
|
|
path("<slug:slug>/edit/", views.ParkUpdateView.as_view(), name="park_update"),
|
|
path("<slug:slug>/actions/", views.park_actions, name="park_actions"),
|
|
# Area views
|
|
path(
|
|
"<slug:park_slug>/areas/<slug:area_slug>/",
|
|
views.ParkAreaDetailView.as_view(),
|
|
name="area_detail",
|
|
),
|
|
# Park-specific category URLs
|
|
path(
|
|
"<slug:park_slug>/roller-coasters/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "RC"},
|
|
name="park_roller_coasters",
|
|
),
|
|
path(
|
|
"<slug:park_slug>/dark-rides/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "DR"},
|
|
name="park_dark_rides",
|
|
),
|
|
path(
|
|
"<slug:park_slug>/flat-rides/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "FR"},
|
|
name="park_flat_rides",
|
|
),
|
|
path(
|
|
"<slug:park_slug>/water-rides/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "WR"},
|
|
name="park_water_rides",
|
|
),
|
|
path(
|
|
"<slug:park_slug>/transports/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "TR"},
|
|
name="park_transports",
|
|
),
|
|
path(
|
|
"<slug:park_slug>/others/",
|
|
ParkSingleCategoryListView.as_view(),
|
|
{"category": "OT"},
|
|
name="park_others",
|
|
),
|
|
# Include park-specific rides URLs
|
|
path(
|
|
"<slug:park_slug>/rides/",
|
|
include("apps.rides.park_urls", namespace="rides"),
|
|
),
|
|
]
|