moviewyrm/bookwyrm/management/commands/populate_lists_streams.py

35 lines
1,005 B
Python
Raw Normal View History

2021-12-30 01:39:14 +00:00
""" Re-create list streams """
2021-11-16 18:41:08 +00:00
from django.core.management.base import BaseCommand
from bookwyrm import lists_stream, models
def populate_lists_streams():
"""build all the lists streams for all the users"""
print("Populating lists streams")
users = models.User.objects.filter(
local=True,
is_active=True,
).order_by("-last_active_date")
print("This may take a long time! Please be patient.")
for user in users:
print(".", end="")
lists_stream.populate_lists_task.delay(user.id)
2021-11-16 18:41:08 +00:00
class Command(BaseCommand):
2021-12-30 01:39:14 +00:00
"""start all over with lists streams"""
2021-11-16 18:41:08 +00:00
2021-12-30 01:39:14 +00:00
help = "Populate list streams for all users"
2021-11-16 18:41:08 +00:00
def add_arguments(self, parser):
parser.add_argument(
"--stream",
default=None,
help="Specifies which time of stream to populate",
)
# pylint: disable=no-self-use,unused-argument
def handle(self, *args, **options):
"""run feed builder"""
populate_lists_streams()