mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 05:51:08 -05:00
Add advanced search and trending parks features; update frontend dependencies and enhance home page layout
This commit is contained in:
@@ -302,6 +302,37 @@ class RideListView(ListView):
|
||||
return context
|
||||
|
||||
|
||||
class NewRidesView(ListView):
|
||||
"""View for displaying recently added rides"""
|
||||
model = Ride
|
||||
template_name = "rides/new_rides.html"
|
||||
context_object_name = "rides"
|
||||
paginate_by = 20
|
||||
|
||||
def get_queryset(self):
|
||||
"""Get recently added rides, ordered by creation date"""
|
||||
return (
|
||||
Ride.objects.all()
|
||||
.select_related("park", "ride_model", "ride_model__manufacturer")
|
||||
.prefetch_related("photos")
|
||||
.order_by("-created_at")
|
||||
)
|
||||
|
||||
def get_template_names(self):
|
||||
"""Return appropriate template for HTMX requests"""
|
||||
if hasattr(self.request, "htmx") and self.request.htmx:
|
||||
return ["rides/partials/new_rides.html"]
|
||||
return [self.template_name]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context.update({
|
||||
'page_title': 'New Attractions',
|
||||
'page_description': 'Discover the latest rides and attractions added to theme parks around the world.'
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
class SingleCategoryListView(ListView):
|
||||
"""View for displaying rides of a specific category"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user