public tags in program XML

This commit is contained in:
Élie Bouttier 2017-11-07 00:44:57 +01:00
parent 8a78a79098
commit bc0b856af2
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-06 22:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cfp', '0018_auto_20171104_1227'),
]
operations = [
migrations.AddField(
model_name='tag',
name='public',
field=models.BooleanField(default=False, verbose_name='Show the tag on the program'),
),
]

View File

@ -205,6 +205,7 @@ class Tag(models.Model):
slug = AutoSlugField(populate_from='name')
color = RGBColorField(default='#ffffff', verbose_name=_("Color"))
inverted = models.BooleanField(default=False)
public = models.BooleanField(default=False, verbose_name=_('Show the tag on the program'))
@property
def link(self):

View File

@ -216,6 +216,10 @@ class Program:
# # 'max': talk.attendees_limit,
# # 'remain': talk.remaining_attendees or 0,
# # }
tags_elt = ET.SubElement(talk_elt, 'tags')
for tag in talk.tags.filter(public=True):
tag_elt = ET.SubElement(tags_elt, 'tag', slug=str(tag.slug))
tag_elt.text = tag.name
elt = ET.SubElement(talk_elt, 'start')
elt.text = localtime(talk.start_date).strftime('%H:%M')
elt = ET.SubElement(talk_elt, 'duration')