Format code using black

This commit is contained in:
Alexandre Iooss 2022-03-02 21:23:40 +01:00
parent 2ad0c8dbc7
commit 59136050fb
14 changed files with 809 additions and 413 deletions

View file

@ -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}")