Files
thrillwiki_django_no_react/shared/docs/memory-bank/features/park-search-integration.md
pacnpal d504d41de2 feat: complete monorepo structure with frontend and shared resources
- 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
2025-08-23 18:40:07 -04:00

2.6 KiB

Park Search Integration

Overview

Integrated the parks app with the site-wide search system to provide consistent filtering and search capabilities across the platform.

Implementation Details

1. Filter Configuration

# parks/filters.py
ParkFilter = create_model_filter(
    model=Park,
    search_fields=['name', 'description', 'location__city', 'location__state', 'location__country'],
    mixins=[LocationFilterMixin, RatingFilterMixin, DateRangeFilterMixin],
    additional_filters={
        'status': {
            'field_class': 'django_filters.ChoiceFilter',
            'field_kwargs': {'choices': Park._meta.get_field('status').choices}
        },
        'opening_date': {
            'field_class': 'django_filters.DateFromToRangeFilter',
        },
        'owner': {
            'field_class': 'django_filters.ModelChoiceFilter',
            'field_kwargs': {'queryset': 'companies.Company.objects.all()'}
        },
        'min_rides': {
            'field_class': 'django_filters.NumberFilter',
            'field_kwargs': {'field_name': 'ride_count', 'lookup_expr': 'gte'}
        },
        'min_coasters': {
            'field_class': 'django_filters.NumberFilter',
            'field_kwargs': {'field_name': 'coaster_count', 'lookup_expr': 'gte'}
        },
        'min_size': {
            'field_class': 'django_filters.NumberFilter',
            'field_kwargs': {'field_name': 'size_acres', 'lookup_expr': 'gte'}
        }
    }
)

2. View Integration

  • Updated ParkListView to use HTMXFilterableMixin
  • Configured proper queryset optimization with select_related and prefetch_related
  • Added pagination support
  • Maintained ride count annotations

3. Template Structure

  • Created search/templates/search/partials/park_results.html for consistent result display
  • Includes:
    • Park image thumbnails
    • Basic park information
    • Location details
    • Status indicators
    • Ride count badges
    • Rating display

4. Quick Search Support

  • Modified search_parks view for dropdown/quick search scenarios
  • Uses the same filter system but with simplified output
  • Limited to 10 results for performance
  • Added location preloading

Benefits

  1. Consistent filtering across the platform
  2. Enhanced search capabilities with location and rating filters
  3. Improved performance through proper query optimization
  4. Better maintainability using the site-wide search system
  5. HTMX-powered dynamic updates

Technical Notes

  • Uses django-filter backend
  • Integrates with location and rating mixins
  • Supports both full search and quick search use cases
  • Maintains existing functionality while improving code organization