mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 15:51:08 -05:00
Refactor model imports and update admin classes to use pghistory for historical tracking; replace HistoricalModel with TrackedModel in relevant models
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from django.db import models
|
||||
from django.utils.text import slugify
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from history_tracking.models import HistoricalModel
|
||||
|
||||
from history_tracking.models import TrackedModel
|
||||
import pghistory
|
||||
|
||||
# Shared choices that will be used by multiple models
|
||||
CATEGORY_CHOICES = [
|
||||
@@ -15,8 +15,8 @@ CATEGORY_CHOICES = [
|
||||
('OT', 'Other'),
|
||||
]
|
||||
|
||||
|
||||
class RideModel(HistoricalModel):
|
||||
@pghistory.track()
|
||||
class RideModel(TrackedModel):
|
||||
"""
|
||||
Represents a specific model/type of ride that can be manufactured by different companies.
|
||||
For example: B&M Dive Coaster, Vekoma Boomerang, etc.
|
||||
@@ -46,8 +46,8 @@ class RideModel(HistoricalModel):
|
||||
def __str__(self) -> str:
|
||||
return self.name if not self.manufacturer else f"{self.manufacturer.name} {self.name}"
|
||||
|
||||
|
||||
class Ride(HistoricalModel):
|
||||
@pghistory.track()
|
||||
class Ride(TrackedModel):
|
||||
STATUS_CHOICES = [
|
||||
('OPERATING', 'Operating'),
|
||||
('SBNO', 'Standing But Not Operating'),
|
||||
@@ -91,7 +91,7 @@ class Ride(HistoricalModel):
|
||||
blank=True
|
||||
)
|
||||
designer = models.ForeignKey(
|
||||
'companies.Designer',
|
||||
'designers.Designer', # Updated to point to the new Designer model
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='rides',
|
||||
null=True,
|
||||
@@ -147,7 +147,6 @@ class Ride(HistoricalModel):
|
||||
self.slug = slugify(self.name)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class RollerCoasterStats(models.Model):
|
||||
TRACK_MATERIAL_CHOICES = [
|
||||
('STEEL', 'Steel'),
|
||||
|
||||
Reference in New Issue
Block a user