Skip to content
Snippets Groups Projects
Commit 3333f45a authored by Virgile Gerecke's avatar Virgile Gerecke :metal:
Browse files

Added template for item content

parent 60f86139
No related merge requests found
<p><b>Date de début : </b>{{ item['start'] }}</p>
<p><b>Date de fin : </b>{{ item['end'] }}</p>
{% if 'duration' in item and item['duration'] != 0 %}
<p><b>Durée : </b>{{ item['duration'] }} minutes</p>
{% endif %}
{{ item['content'] }}
\ No newline at end of file
anytree==2.4.3
feedgen==0.7.0
python-slugify==1.2.6
Jinja2==2.10
\ No newline at end of file
......@@ -3,6 +3,7 @@ from json import load
import dateutil.parser
from feedgen.feed import FeedGenerator
from slugify import slugify
from jinja2 import Template
data = load(open('weather.json', 'r'))
......@@ -23,6 +24,8 @@ fg.logo('https://langagevisuel.unistra.fr/fileadmin/Contenu/4.2.Favicon/favicon2
slugs = []
template = Template(open('item.html', 'r').read())
for item in data:
fe = fg.add_entry()
title = item['title']
......@@ -32,10 +35,7 @@ for item in data:
slugs.append(slug)
fe.title(title)
fe.id(slugify(title))
content = "<p><b>Date de début : </b>{}</p><p><b>Date de fin : </b>{}</p>{}".format(df(item['start']),
df(item['end']),
item['content'])
fe.description(content)
fe.description(template.render(item=item))
fe.pubDate(item['start'])
fg.link(href='https://support.unistra.fr/rss.php', rel='self')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment