Use values_list with flat, yay!

This commit is contained in:
Joel Bradshaw 2022-06-07 23:14:45 -07:00
parent 3aa159bc89
commit 7f5d47a36f

View file

@ -56,12 +56,12 @@ class Command(BaseCommand):
self.stdout.write(" OK 🖼")
# Books
book_ids = [
values["id"]
for values in models.Book.objects.select_subclasses()
book_ids = (
models.Book.objects.select_subclasses()
.filter()
.values("id")
]
.values_list("id", flat=True)
)
self.stdout.write(
" → Book preview images ({}): ".format(len(book_ids)), ending=""
)