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:
@@ -37,9 +37,7 @@ class Command(BaseCommand):
|
||||
identifier = photo.park.slug
|
||||
|
||||
# Look for any files in that directory
|
||||
old_dir = os.path.join(
|
||||
settings.MEDIA_ROOT, content_type, identifier
|
||||
)
|
||||
old_dir = os.path.join(settings.MEDIA_ROOT, content_type, identifier)
|
||||
if os.path.exists(old_dir):
|
||||
files = [
|
||||
f
|
||||
@@ -83,9 +81,7 @@ class Command(BaseCommand):
|
||||
|
||||
# Move the file
|
||||
if current_path != new_full_path:
|
||||
shutil.copy2(
|
||||
current_path, new_full_path
|
||||
) # Use copy2 to preserve metadata
|
||||
shutil.copy2(current_path, new_full_path) # Use copy2 to preserve metadata
|
||||
processed_files.add(current_path)
|
||||
else:
|
||||
processed_files.add(current_path)
|
||||
@@ -116,9 +112,7 @@ class Command(BaseCommand):
|
||||
identifier = parts[1] # e.g., 'alton-towers'
|
||||
|
||||
# Look for any files in that directory
|
||||
old_dir = os.path.join(
|
||||
settings.MEDIA_ROOT, content_type, identifier
|
||||
)
|
||||
old_dir = os.path.join(settings.MEDIA_ROOT, content_type, identifier)
|
||||
if os.path.exists(old_dir):
|
||||
files = [
|
||||
f
|
||||
@@ -162,9 +156,7 @@ class Command(BaseCommand):
|
||||
|
||||
# Move the file
|
||||
if current_path != new_full_path:
|
||||
shutil.copy2(
|
||||
current_path, new_full_path
|
||||
) # Use copy2 to preserve metadata
|
||||
shutil.copy2(current_path, new_full_path) # Use copy2 to preserve metadata
|
||||
processed_files.add(current_path)
|
||||
else:
|
||||
processed_files.add(current_path)
|
||||
@@ -192,8 +184,6 @@ class Command(BaseCommand):
|
||||
os.remove(file_path)
|
||||
self.stdout.write(f"Removed old file: {file_path}")
|
||||
except Exception as e:
|
||||
self.stdout.write(
|
||||
f"Error removing {file_path}: {str(e)}"
|
||||
)
|
||||
self.stdout.write(f"Error removing {file_path}: {str(e)}")
|
||||
|
||||
self.stdout.write("Finished moving photo files and cleaning up")
|
||||
|
||||
Reference in New Issue
Block a user