mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-02 03:27:02 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -22,9 +22,7 @@ def park_photo_upload_path(instance: models.Model, filename: str) -> str:
|
||||
if park is None:
|
||||
raise ValueError("Park cannot be None")
|
||||
|
||||
return MediaService.generate_upload_path(
|
||||
domain="park", identifier=park.slug, filename=filename
|
||||
)
|
||||
return MediaService.generate_upload_path(domain="park", identifier=park.slug, filename=filename)
|
||||
|
||||
|
||||
@pghistory.track()
|
||||
@@ -39,23 +37,15 @@ class ParkPhoto(TrackedModel):
|
||||
)
|
||||
|
||||
image = models.ForeignKey(
|
||||
'django_cloudflareimages_toolkit.CloudflareImage',
|
||||
"django_cloudflareimages_toolkit.CloudflareImage",
|
||||
on_delete=models.CASCADE,
|
||||
help_text="Park photo stored on Cloudflare Images"
|
||||
help_text="Park photo stored on Cloudflare Images",
|
||||
)
|
||||
|
||||
caption = models.CharField(
|
||||
max_length=255, blank=True, help_text="Photo caption or description"
|
||||
)
|
||||
alt_text = models.CharField(
|
||||
max_length=255, blank=True, help_text="Alternative text for accessibility"
|
||||
)
|
||||
is_primary = models.BooleanField(
|
||||
default=False, help_text="Whether this is the primary photo for the park"
|
||||
)
|
||||
is_approved = models.BooleanField(
|
||||
default=False, help_text="Whether this photo has been approved by moderators"
|
||||
)
|
||||
caption = models.CharField(max_length=255, blank=True, help_text="Photo caption or description")
|
||||
alt_text = models.CharField(max_length=255, blank=True, help_text="Alternative text for accessibility")
|
||||
is_primary = models.BooleanField(default=False, help_text="Whether this is the primary photo for the park")
|
||||
is_approved = models.BooleanField(default=False, help_text="Whether this photo has been approved by moderators")
|
||||
|
||||
# Metadata
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
@@ -100,9 +90,7 @@ class ParkPhoto(TrackedModel):
|
||||
|
||||
# Set default caption if not provided
|
||||
if not self.caption and self.uploaded_by:
|
||||
self.caption = MediaService.generate_default_caption(
|
||||
self.uploaded_by.username
|
||||
)
|
||||
self.caption = MediaService.generate_default_caption(self.uploaded_by.username)
|
||||
|
||||
# If this is marked as primary, unmark other primary photos for this park
|
||||
if self.is_primary:
|
||||
|
||||
Reference in New Issue
Block a user