1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.core.management import BaseCommand
7 from catalogue.models import Tag
10 class Command(BaseCommand):
11 help = "Update description for given tag."
12 args = 'category slug description_filename'
14 def handle(self, category, slug, description_filename, **options):
15 tag = Tag.objects.get(category=category, slug=slug)
16 description = open(description_filename).read().decode('utf-8')
17 tag.description = description