mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 08:11:08 -05:00
Add merge migrations for parks, companies, and moderation apps; update EmailConfiguration, Review, Photo, TopList, and TopListItem models to use pghistory for historical tracking
This commit is contained in:
@@ -11,6 +11,8 @@ from datetime import datetime
|
||||
from .storage import MediaStorage
|
||||
from rides.models import Ride
|
||||
from django.utils import timezone
|
||||
from history_tracking.models import TrackedModel
|
||||
import pghistory
|
||||
|
||||
def photo_upload_path(instance: models.Model, filename: str) -> str:
|
||||
"""Generate upload path for photos using normalized filenames"""
|
||||
@@ -38,7 +40,8 @@ def photo_upload_path(instance: models.Model, filename: str) -> str:
|
||||
# For park photos, store directly in park directory
|
||||
return f"park/{identifier}/{base_filename}"
|
||||
|
||||
class Photo(models.Model):
|
||||
@pghistory.track()
|
||||
class Photo(TrackedModel):
|
||||
"""Generic photo model that can be attached to any model"""
|
||||
image = models.ImageField(
|
||||
upload_to=photo_upload_path, # type: ignore[arg-type]
|
||||
|
||||
Reference in New Issue
Block a user