mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 17:31:09 -05:00
- Introduced Next.js integration guide for ThrillWiki API, detailing authentication, core domain APIs, data structures, and implementation patterns. - Documented the migration to Rich Choice Objects, highlighting changes for frontend developers and enhanced metadata availability. - Fixed the missing `get_by_slug` method in the Ride model, ensuring proper functionality of ride detail endpoints. - Created a test script to verify manufacturer syncing with ride models, ensuring data integrity across related models.
289 lines
8.7 KiB
Python
289 lines
8.7 KiB
Python
"""
|
|
Rich Choice Objects for Parks Domain
|
|
|
|
This module defines all choice objects for the parks domain, replacing
|
|
the legacy tuple-based choices with rich choice objects.
|
|
"""
|
|
|
|
from apps.core.choices import RichChoice, ChoiceCategory
|
|
from apps.core.choices.registry import register_choices
|
|
|
|
|
|
# Park Status Choices
|
|
PARK_STATUSES = [
|
|
RichChoice(
|
|
value="OPERATING",
|
|
label="Operating",
|
|
description="Park is currently open and operating normally",
|
|
metadata={
|
|
'color': 'green',
|
|
'icon': 'check-circle',
|
|
'css_class': 'bg-green-100 text-green-800',
|
|
'sort_order': 1
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
RichChoice(
|
|
value="CLOSED_TEMP",
|
|
label="Temporarily Closed",
|
|
description="Park is temporarily closed for maintenance, weather, or seasonal reasons",
|
|
metadata={
|
|
'color': 'yellow',
|
|
'icon': 'pause-circle',
|
|
'css_class': 'bg-yellow-100 text-yellow-800',
|
|
'sort_order': 2
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
RichChoice(
|
|
value="CLOSED_PERM",
|
|
label="Permanently Closed",
|
|
description="Park has been permanently closed and will not reopen",
|
|
metadata={
|
|
'color': 'red',
|
|
'icon': 'x-circle',
|
|
'css_class': 'bg-red-100 text-red-800',
|
|
'sort_order': 3
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
RichChoice(
|
|
value="UNDER_CONSTRUCTION",
|
|
label="Under Construction",
|
|
description="Park is currently being built or undergoing major renovation",
|
|
metadata={
|
|
'color': 'blue',
|
|
'icon': 'tool',
|
|
'css_class': 'bg-blue-100 text-blue-800',
|
|
'sort_order': 4
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
RichChoice(
|
|
value="DEMOLISHED",
|
|
label="Demolished",
|
|
description="Park has been completely demolished and removed",
|
|
metadata={
|
|
'color': 'gray',
|
|
'icon': 'trash',
|
|
'css_class': 'bg-gray-100 text-gray-800',
|
|
'sort_order': 5
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
RichChoice(
|
|
value="RELOCATED",
|
|
label="Relocated",
|
|
description="Park has been moved to a different location",
|
|
metadata={
|
|
'color': 'purple',
|
|
'icon': 'arrow-right',
|
|
'css_class': 'bg-purple-100 text-purple-800',
|
|
'sort_order': 6
|
|
},
|
|
category=ChoiceCategory.STATUS
|
|
),
|
|
]
|
|
|
|
# Park Type Choices
|
|
PARK_TYPES = [
|
|
RichChoice(
|
|
value="THEME_PARK",
|
|
label="Theme Park",
|
|
description="Large-scale amusement park with themed areas and attractions",
|
|
metadata={
|
|
'color': 'red',
|
|
'icon': 'castle',
|
|
'css_class': 'bg-red-100 text-red-800',
|
|
'sort_order': 1
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="AMUSEMENT_PARK",
|
|
label="Amusement Park",
|
|
description="Traditional amusement park with rides and games",
|
|
metadata={
|
|
'color': 'blue',
|
|
'icon': 'ferris-wheel',
|
|
'css_class': 'bg-blue-100 text-blue-800',
|
|
'sort_order': 2
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="WATER_PARK",
|
|
label="Water Park",
|
|
description="Park featuring water-based attractions and activities",
|
|
metadata={
|
|
'color': 'cyan',
|
|
'icon': 'water',
|
|
'css_class': 'bg-cyan-100 text-cyan-800',
|
|
'sort_order': 3
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="FAMILY_ENTERTAINMENT_CENTER",
|
|
label="Family Entertainment Center",
|
|
description="Indoor entertainment facility with games and family attractions",
|
|
metadata={
|
|
'color': 'green',
|
|
'icon': 'family',
|
|
'css_class': 'bg-green-100 text-green-800',
|
|
'sort_order': 4
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="CARNIVAL",
|
|
label="Carnival",
|
|
description="Traveling amusement show with rides, games, and entertainment",
|
|
metadata={
|
|
'color': 'yellow',
|
|
'icon': 'carnival',
|
|
'css_class': 'bg-yellow-100 text-yellow-800',
|
|
'sort_order': 5
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="FAIR",
|
|
label="Fair",
|
|
description="Temporary event featuring rides, games, and agricultural exhibits",
|
|
metadata={
|
|
'color': 'orange',
|
|
'icon': 'fair',
|
|
'css_class': 'bg-orange-100 text-orange-800',
|
|
'sort_order': 6
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="PIER",
|
|
label="Pier",
|
|
description="Seaside entertainment pier with rides and attractions",
|
|
metadata={
|
|
'color': 'teal',
|
|
'icon': 'pier',
|
|
'css_class': 'bg-teal-100 text-teal-800',
|
|
'sort_order': 7
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="BOARDWALK",
|
|
label="Boardwalk",
|
|
description="Waterfront entertainment area with rides and attractions",
|
|
metadata={
|
|
'color': 'indigo',
|
|
'icon': 'boardwalk',
|
|
'css_class': 'bg-indigo-100 text-indigo-800',
|
|
'sort_order': 8
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="SAFARI_PARK",
|
|
label="Safari Park",
|
|
description="Wildlife park with drive-through animal experiences",
|
|
metadata={
|
|
'color': 'emerald',
|
|
'icon': 'safari',
|
|
'css_class': 'bg-emerald-100 text-emerald-800',
|
|
'sort_order': 9
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="ZOO",
|
|
label="Zoo",
|
|
description="Zoological park with animal exhibits and educational programs",
|
|
metadata={
|
|
'color': 'lime',
|
|
'icon': 'zoo',
|
|
'css_class': 'bg-lime-100 text-lime-800',
|
|
'sort_order': 10
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="OTHER",
|
|
label="Other",
|
|
description="Park type that doesn't fit into standard categories",
|
|
metadata={
|
|
'color': 'gray',
|
|
'icon': 'other',
|
|
'css_class': 'bg-gray-100 text-gray-800',
|
|
'sort_order': 11
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
]
|
|
|
|
# Company Role Choices for Parks Domain (OPERATOR and PROPERTY_OWNER only)
|
|
PARKS_COMPANY_ROLES = [
|
|
RichChoice(
|
|
value="OPERATOR",
|
|
label="Park Operator",
|
|
description="Company that operates and manages theme parks and amusement facilities",
|
|
metadata={
|
|
'color': 'blue',
|
|
'icon': 'building-office',
|
|
'css_class': 'bg-blue-100 text-blue-800',
|
|
'sort_order': 1,
|
|
'domain': 'parks',
|
|
'permissions': ['manage_parks', 'view_operations'],
|
|
'url_pattern': '/parks/operators/{slug}/'
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
RichChoice(
|
|
value="PROPERTY_OWNER",
|
|
label="Property Owner",
|
|
description="Company that owns the land and property where parks are located",
|
|
metadata={
|
|
'color': 'green',
|
|
'icon': 'home',
|
|
'css_class': 'bg-green-100 text-green-800',
|
|
'sort_order': 2,
|
|
'domain': 'parks',
|
|
'permissions': ['manage_property', 'view_ownership'],
|
|
'url_pattern': '/parks/owners/{slug}/'
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION
|
|
),
|
|
]
|
|
|
|
|
|
def register_parks_choices():
|
|
"""Register all parks domain choices with the global registry"""
|
|
|
|
register_choices(
|
|
name="statuses",
|
|
choices=PARK_STATUSES,
|
|
domain="parks",
|
|
description="Park operational status options",
|
|
metadata={'domain': 'parks', 'type': 'status'}
|
|
)
|
|
|
|
register_choices(
|
|
name="types",
|
|
choices=PARK_TYPES,
|
|
domain="parks",
|
|
description="Park type and category classifications",
|
|
metadata={'domain': 'parks', 'type': 'park_type'}
|
|
)
|
|
|
|
register_choices(
|
|
name="company_roles",
|
|
choices=PARKS_COMPANY_ROLES,
|
|
domain="parks",
|
|
description="Company role classifications for parks domain (OPERATOR and PROPERTY_OWNER only)",
|
|
metadata={'domain': 'parks', 'type': 'company_role'}
|
|
)
|
|
|
|
|
|
# Auto-register choices when module is imported
|
|
register_parks_choices()
|