mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 07:31:07 -05:00
Add comprehensive API documentation for ThrillWiki integration and features
- 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.
This commit is contained in:
@@ -6,6 +6,7 @@ from config.django import base as settings
|
||||
from typing import Optional, Any, TYPE_CHECKING, List
|
||||
import pghistory
|
||||
from apps.core.history import TrackedModel
|
||||
from apps.core.choices import RichChoiceField
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -20,39 +21,21 @@ class Park(TrackedModel):
|
||||
|
||||
objects = ParkManager()
|
||||
id: int # Type hint for Django's automatic id field
|
||||
STATUS_CHOICES = [
|
||||
("OPERATING", "Operating"),
|
||||
("CLOSED_TEMP", "Temporarily Closed"),
|
||||
("CLOSED_PERM", "Permanently Closed"),
|
||||
("UNDER_CONSTRUCTION", "Under Construction"),
|
||||
("DEMOLISHED", "Demolished"),
|
||||
("RELOCATED", "Relocated"),
|
||||
]
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
slug = models.SlugField(max_length=255, unique=True)
|
||||
description = models.TextField(blank=True)
|
||||
status = models.CharField(
|
||||
max_length=20, choices=STATUS_CHOICES, default="OPERATING"
|
||||
status = RichChoiceField(
|
||||
choice_group="statuses",
|
||||
domain="parks",
|
||||
max_length=20,
|
||||
default="OPERATING",
|
||||
)
|
||||
|
||||
PARK_TYPE_CHOICES = [
|
||||
("THEME_PARK", "Theme Park"),
|
||||
("AMUSEMENT_PARK", "Amusement Park"),
|
||||
("WATER_PARK", "Water Park"),
|
||||
("FAMILY_ENTERTAINMENT_CENTER", "Family Entertainment Center"),
|
||||
("CARNIVAL", "Carnival"),
|
||||
("FAIR", "Fair"),
|
||||
("PIER", "Pier"),
|
||||
("BOARDWALK", "Boardwalk"),
|
||||
("SAFARI_PARK", "Safari Park"),
|
||||
("ZOO", "Zoo"),
|
||||
("OTHER", "Other"),
|
||||
]
|
||||
|
||||
park_type = models.CharField(
|
||||
park_type = RichChoiceField(
|
||||
choice_group="types",
|
||||
domain="parks",
|
||||
max_length=30,
|
||||
choices=PARK_TYPE_CHOICES,
|
||||
default="THEME_PARK",
|
||||
db_index=True,
|
||||
help_text="Type/category of the park"
|
||||
@@ -291,7 +274,10 @@ class Park(TrackedModel):
|
||||
"DEMOLISHED": "bg-gray-100 text-gray-800",
|
||||
"RELOCATED": "bg-purple-100 text-purple-800",
|
||||
}
|
||||
return status_colors.get(self.status, "bg-gray-100 text-gray-500")
|
||||
if self.status in status_colors:
|
||||
return status_colors[self.status]
|
||||
else:
|
||||
raise ValueError(f"Unknown park status: {self.status}")
|
||||
|
||||
@property
|
||||
def formatted_location(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user