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

@ -6,16 +6,13 @@ from photologue.models import ImageModel, PhotoSize
class Command(BaseCommand):
help = 'Clears the Photologue cache for the given sizes.'
help = "Clears the Photologue cache for the given sizes."
def add_arguments(self, parser):
parser.add_argument('sizes',
nargs='*',
type=str,
help='Name of the photosize.')
parser.add_argument("sizes", nargs="*", type=str, help="Name of the photosize.")
def handle(self, *args, **options):
sizes = options['sizes']
sizes = options["sizes"]
if not sizes:
photosizes = PhotoSize.objects.all()
@ -23,12 +20,12 @@ class Command(BaseCommand):
photosizes = PhotoSize.objects.filter(name__in=sizes)
if not len(photosizes):
raise CommandError('No photo sizes were found.')
raise CommandError("No photo sizes were found.")
print('Flushing cache...')
print("Flushing cache...")
for cls in ImageModel.__subclasses__():
for photosize in photosizes:
print('Flushing %s size images' % photosize.name)
print("Flushing %s size images" % photosize.name)
for obj in cls.objects.all():
obj.remove_size(photosize)