Format code using black
This commit is contained in:
parent
2ad0c8dbc7
commit
59136050fb
14 changed files with 809 additions and 413 deletions
|
|
@ -7,22 +7,21 @@ from photologue.models import ImageModel, PhotoSize
|
|||
|
||||
class Command(BaseCommand):
|
||||
|
||||
help = 'Manages Photologue cache file for the given sizes.'
|
||||
help = "Manages Photologue cache file for the given sizes."
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('sizes',
|
||||
nargs='*',
|
||||
type=str,
|
||||
help='Name of the photosize.')
|
||||
parser.add_argument('--reset',
|
||||
action='store_true',
|
||||
default=False,
|
||||
dest='reset',
|
||||
help='Reset photo cache before generating.')
|
||||
parser.add_argument("sizes", nargs="*", type=str, help="Name of the photosize.")
|
||||
parser.add_argument(
|
||||
"--reset",
|
||||
action="store_true",
|
||||
default=False,
|
||||
dest="reset",
|
||||
help="Reset photo cache before generating.",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
reset = options['reset']
|
||||
sizes = options['sizes']
|
||||
reset = options["reset"]
|
||||
sizes = options["sizes"]
|
||||
|
||||
if not sizes:
|
||||
photosizes = PhotoSize.objects.all()
|
||||
|
|
@ -30,13 +29,13 @@ 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('Caching photos, this may take a while...')
|
||||
print("Caching photos, this may take a while...")
|
||||
|
||||
for cls in ImageModel.__subclasses__():
|
||||
for photosize in photosizes:
|
||||
print('Cacheing %s size images' % photosize.name)
|
||||
print("Cacheing %s size images" % photosize.name)
|
||||
for obj in cls.objects.all():
|
||||
if reset:
|
||||
obj.remove_size(photosize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue