Format code using black
This commit is contained in:
parent
2ad0c8dbc7
commit
59136050fb
14 changed files with 809 additions and 413 deletions
|
|
@ -7,17 +7,17 @@ from photologue.models import Gallery
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Rename uploaded media file to match gallery and photo names'
|
||||
help = "Rename uploaded media file to match gallery and photo names"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--apply', action='store_true')
|
||||
parser.add_argument("--apply", action="store_true")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
media_dir = Path(settings.MEDIA_ROOT)
|
||||
for gallery in Gallery.objects.all():
|
||||
# Create gallery directory
|
||||
gallery_year = str(gallery.date_start.year)
|
||||
gallery_dir = Path('photos') / gallery_year / gallery.slug
|
||||
gallery_dir = Path("photos") / gallery_year / gallery.slug
|
||||
gallery_path = media_dir / gallery_dir
|
||||
if not gallery_path.exists():
|
||||
self.stdout.write(f"Creating {gallery_dir}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue