mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 13:15:17 -05:00
lol
This commit is contained in:
@@ -508,7 +508,21 @@ class Ride(StateMachineMixin, TrackedModel):
|
||||
help_text="Status to change to after closing date",
|
||||
)
|
||||
opening_date = models.DateField(null=True, blank=True)
|
||||
opening_date_precision = models.CharField(
|
||||
max_length=10,
|
||||
choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
|
||||
default="DAY",
|
||||
blank=True,
|
||||
help_text="Precision of the opening date",
|
||||
)
|
||||
closing_date = models.DateField(null=True, blank=True)
|
||||
closing_date_precision = models.CharField(
|
||||
max_length=10,
|
||||
choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
|
||||
default="DAY",
|
||||
blank=True,
|
||||
help_text="Precision of the closing date",
|
||||
)
|
||||
status_since = models.DateField(null=True, blank=True)
|
||||
min_height_in = models.PositiveIntegerField(null=True, blank=True)
|
||||
max_height_in = models.PositiveIntegerField(null=True, blank=True)
|
||||
@@ -516,6 +530,18 @@ class Ride(StateMachineMixin, TrackedModel):
|
||||
ride_duration_seconds = models.PositiveIntegerField(null=True, blank=True)
|
||||
average_rating = models.DecimalField(max_digits=3, decimal_places=2, null=True, blank=True)
|
||||
|
||||
# Additional ride classification
|
||||
ride_sub_type = models.CharField(
|
||||
max_length=100,
|
||||
blank=True,
|
||||
help_text="Sub-category of ride (e.g., 'Flying Coaster', 'Inverted Coaster', 'Log Flume')",
|
||||
)
|
||||
age_requirement = models.PositiveIntegerField(
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Minimum age requirement in years (if any)",
|
||||
)
|
||||
|
||||
# Computed fields for hybrid filtering
|
||||
opening_year = models.IntegerField(null=True, blank=True, db_index=True)
|
||||
search_text = models.TextField(blank=True, db_index=True)
|
||||
@@ -680,6 +706,14 @@ class Ride(StateMachineMixin, TrackedModel):
|
||||
|
||||
self.save()
|
||||
|
||||
@property
|
||||
def is_closing(self) -> bool:
|
||||
"""Returns True if this ride has a closing date in the future (announced closure)."""
|
||||
from django.utils import timezone
|
||||
if self.closing_date:
|
||||
return self.closing_date > timezone.now().date()
|
||||
return False
|
||||
|
||||
def save(self, *args, **kwargs) -> None:
|
||||
# Handle slug generation and conflicts
|
||||
if not self.slug:
|
||||
|
||||
Reference in New Issue
Block a user