1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00
acronomy/acros/management/commands/refetch_wikipedia.py

18 lines
544 B
Python
Raw Normal View History

2020-06-08 18:45:38 +02:00
from django.core.management.base import BaseCommand
2020-06-08 20:33:29 +02:00
from simple_history.utils import update_change_reason
2020-06-08 18:45:38 +02:00
from acros.models import WikipediaLink
class Command(BaseCommand):
help = 'Updates all Wikipedia articles'
def handle(self, *args, **options):
links = WikipediaLink.objects.all()
for link in links:
if link.fetched:
self.stdout.write(link.title)
link.fetched = False
2020-06-08 20:33:29 +02:00
update_change_reason(link, "refetch_wikipedia command")
2020-06-08 18:45:38 +02:00
link.save()