From bc0b856af286fbfb4b4746021d16b076ebf716cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Tue, 7 Nov 2017 00:44:57 +0100 Subject: [PATCH] public tags in program XML --- cfp/migrations/0019_tag_public.py | 20 ++++++++++++++++++++ cfp/models.py | 1 + cfp/planning.py | 4 ++++ 3 files changed, 25 insertions(+) create mode 100644 cfp/migrations/0019_tag_public.py diff --git a/cfp/migrations/0019_tag_public.py b/cfp/migrations/0019_tag_public.py new file mode 100644 index 0000000..86587a1 --- /dev/null +++ b/cfp/migrations/0019_tag_public.py @@ -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'), + ), + ] diff --git a/cfp/models.py b/cfp/models.py index 42bbb69..e83164f 100644 --- a/cfp/models.py +++ b/cfp/models.py @@ -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): diff --git a/cfp/planning.py b/cfp/planning.py index e63f0e6..38f5766 100644 --- a/cfp/planning.py +++ b/cfp/planning.py @@ -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')