1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from celery import shared_task
6 from django.core.files.base import ContentFile
7 from django.template.loader import render_to_string
11 def generate_picture_html(picture_id):
13 pic = picture.models.Picture.objects.get(pk=picture_id)
14 areas_json = json.loads(pic.areas_json)
16 html_text = render_to_string('picture/picture_info.html', {
17 'things': areas_json['things'],
18 'themes': areas_json['themes'],
20 pic.html_file.save("%s.html" % pic.slug, ContentFile(html_text))