feat: Implement UI components for Django templates

- Added Button component with various styles and sizes.
- Introduced Card component for displaying content with titles and descriptions.
- Created Input component for form fields with support for various attributes.
- Developed Toast Notification Container for displaying alerts and messages.
- Designed pages for listing designers and operators with pagination and responsive layout.
- Documented frontend migration from React to HTMX + Alpine.js, detailing component usage and integration.
This commit is contained in:
pacnpal
2025-09-19 19:04:37 -04:00
parent 209b433577
commit 42a3dc7637
27 changed files with 3855 additions and 284 deletions

View File

@@ -849,3 +849,28 @@ class ParkAreaDetailView(
def get_redirect_url_kwargs(self) -> dict[str, str]:
area = cast(ParkArea, self.object)
return {"park_slug": area.park.slug, "area_slug": area.slug}
class OperatorListView(ListView):
"""View for displaying a list of park operators"""
template_name = "operators/operator_list.html"
context_object_name = "operators"
paginate_by = 24
def get_queryset(self):
"""Get companies that are operators"""
from .models.companies import Company
from django.db.models import Count
return (
Company.objects.filter(roles__contains=["OPERATOR"])
.annotate(park_count=Count("operated_parks"))
.order_by("name")
)
def get_context_data(self, **kwargs):
"""Add context data"""
context = super().get_context_data(**kwargs)
context["total_operators"] = self.get_queryset().count()
return context