1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from django.core.management import BaseCommand
5 from catalogue.models import Tag
8 class Command(BaseCommand):
9 help = "Update description for given tag."
11 def add_arguments(self, parser):
12 parser.add_argument('category')
13 parser.add_argument('slug')
14 parser.add_argument('description_filename')
16 def handle(self, category, slug, description_filename, **options):
17 tag = Tag.objects.get(category=category, slug=slug)
18 description = open(description_filename).read().decode('utf-8')
19 tag.description = description