1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-28 01:09:37 +02:00

refactor(models, views, serializers): rename LocationImage and Attachment to ContentImage and ContentAttachment, update related references

This commit is contained in:
Sean Morley 2025-07-10 12:12:03 -04:00
parent 1b841f45a0
commit 7f80dad94b
13 changed files with 371 additions and 86 deletions

View file

@ -1,7 +1,7 @@
import os
from django.core.management.base import BaseCommand
from django.conf import settings
from adventures.models import LocationImage, Attachment
from adventures.models import ContentImage, ContentAttachment
from users.models import CustomUser
@ -21,13 +21,13 @@ class Command(BaseCommand):
# Get all image and attachment file paths from database
used_files = set()
# Get LocationImage file paths
for img in LocationImage.objects.all():
# Get ContentImage file paths
for img in ContentImage.objects.all():
if img.image and img.image.name:
used_files.add(os.path.join(settings.MEDIA_ROOT, img.image.name))
# Get Attachment file paths
for attachment in Attachment.objects.all():
for attachment in ContentAttachment.objects.all():
if attachment.file and attachment.file.name:
used_files.add(os.path.join(settings.MEDIA_ROOT, attachment.file.name))