Add htmlicon field to all sessions
authorMagnus Hagander <magnus@hagander.net>
Sun, 18 Nov 2018 18:01:53 +0000 (19:01 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sun, 18 Nov 2018 18:01:53 +0000 (19:01 +0100)
This makes it possible to store a HTML icon for the session, such as a
coffee mug or similar, in the record instead of having ugly
if-this-then-that chains in the template comparing the name of the
session.

docs/confreg/schedule.md
postgresqleu/confreg/backendforms.py
postgresqleu/confreg/migrations/0036_htmlicon.py [new file with mode: 0644]
postgresqleu/confreg/models.py
postgresqleu/confreg/views.py

index f923158947b40c30975bd5ad6fa511f6ffc036bc..0ce7ba1efd5ab295c941cc473290b161fc9472d4 100644 (file)
@@ -122,6 +122,11 @@ Speakers
 profile before it can be used here, but it the same speaker
 profile can be used across multiple conferences.
 
+HTML Icon
+:   HTML code to be inserted into schedule (and possibly other places)
+representing this session. Can be used to include icons like coffee
+mugs for coffee breaks etc. Should be pure HTML.
+
 Status
 :      The [state](callforpapers#states) state of this session.
 
index ce7836977eec9005014efb865d0561024ff2f3f6..19f14e9f4cf0d9a77f21a510c727e7248199e21f 100644 (file)
@@ -455,7 +455,7 @@ class BackendConferenceSessionForm(BackendForm):
 
        class Meta:
                model = ConferenceSession
-               fields = ['title', 'speaker', 'status', 'starttime', 'endtime', 'cross_schedule',
+               fields = ['title', 'htmlicon', 'speaker', 'status', 'starttime', 'endtime', 'cross_schedule',
                                  'track', 'room', 'can_feedback', 'skill_level', 'abstract', 'submissionnote']
 
        def fix_fields(self):
diff --git a/postgresqleu/confreg/migrations/0036_htmlicon.py b/postgresqleu/confreg/migrations/0036_htmlicon.py
new file mode 100644 (file)
index 0000000..21d8908
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2018-11-18 18:48
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('confreg', '0035_confseries_administrators'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='conferencesession',
+            name='htmlicon',
+            field=models.CharField(blank=True, help_text=b'HTML representing an icon used for this session on the schedule (and optionally elsewhere)', max_length=100, verbose_name=b'HTML Icon'),
+        ),
+    ]
index a86bb3e29faa46f94442102a37b5c8fd63c25659..8bbc59f8d58044d47a1891b64339cb3b00064895 100644 (file)
@@ -671,6 +671,7 @@ class ConferenceSession(models.Model):
        can_feedback = models.BooleanField(null=False, default=True)
        abstract = models.TextField(null=False, blank=True)
        skill_level = models.IntegerField(null=False, default=1, choices=SKILL_CHOICES)
+       htmlicon = models.CharField(max_length=100, null=False, blank=True, verbose_name="HTML Icon", help_text="HTML representing an icon used for this session on the schedule (and optionally elsewhere)")
        status = models.IntegerField(null=False, default=0, choices=STATUS_CHOICES)
        lastnotifiedstatus = models.IntegerField(null=False, default=0, choices=STATUS_CHOICES)
        lastnotifiedtime = models.DateTimeField(null=True, blank=True, verbose_name="Notification last sent")
index 4f88b850f7b8e97c0bbdfd873076ea5aff8aab31..d4678f2341b801be719a1ef736f694190b14cff9 100644 (file)
@@ -1011,7 +1011,7 @@ def _scheduledata(request, conference):
                'confid': conference.id,
        })
 
-       raw = exec_to_grouped_dict("SELECT s.starttime::date AS day, s.id, s.starttime, s.endtime, to_json(t.*) AS track, s.track_id, to_json(r.*) AS room, s.room_id, s.title, to_char(starttime, 'HH24:MI') || ' - ' || to_char(endtime, 'HH24:MI') AS timeslot, extract(epoch FROM endtime-starttime)/60 AS length, min(starttime) OVER days AS firsttime, max(endtime) OVER days AS lasttime, cross_schedule, EXISTS (SELECT 1 FROM confreg_conferencesessionslides sl WHERE sl.session_id=s.id) AS has_slides, COALESCE(json_agg(json_build_object('id', spk.id, 'name', spk.fullname, 'company', spk.company, 'twittername', spk.twittername)) FILTER (WHERE spk.id IS NOT NULL), '[]') AS speakers FROM confreg_conferencesession s LEFT JOIN confreg_track t ON t.id=s.track_id LEFT JOIN confreg_room r ON r.id=s.room_id LEFT JOIN confreg_conferencesession_speaker css ON css.conferencesession_id=s.id LEFT JOIN confreg_speaker spk ON spk.id=css.speaker_id WHERE s.conference_id=%(confid)s AND s.status=1 AND (cross_schedule OR room_id IS NOT NULL) GROUP BY s.id, t.id, r.id WINDOW days AS (PARTITION BY s.starttime::date) ORDER BY day, s.starttime, r.sortkey", {
+       raw = exec_to_grouped_dict("SELECT s.starttime::date AS day, s.id, s.starttime, s.endtime, to_json(t.*) AS track, s.track_id, to_json(r.*) AS room, s.room_id, s.title, s.htmlicon, to_char(starttime, 'HH24:MI') || ' - ' || to_char(endtime, 'HH24:MI') AS timeslot, extract(epoch FROM endtime-starttime)/60 AS length, min(starttime) OVER days AS firsttime, max(endtime) OVER days AS lasttime, cross_schedule, EXISTS (SELECT 1 FROM confreg_conferencesessionslides sl WHERE sl.session_id=s.id) AS has_slides, COALESCE(json_agg(json_build_object('id', spk.id, 'name', spk.fullname, 'company', spk.company, 'twittername', spk.twittername)) FILTER (WHERE spk.id IS NOT NULL), '[]') AS speakers FROM confreg_conferencesession s LEFT JOIN confreg_track t ON t.id=s.track_id LEFT JOIN confreg_room r ON r.id=s.room_id LEFT JOIN confreg_conferencesession_speaker css ON css.conferencesession_id=s.id LEFT JOIN confreg_speaker spk ON spk.id=css.speaker_id WHERE s.conference_id=%(confid)s AND s.status=1 AND (cross_schedule OR room_id IS NOT NULL) GROUP BY s.id, t.id, r.id WINDOW days AS (PARTITION BY s.starttime::date) ORDER BY day, s.starttime, r.sortkey", {
                'confid': conference.id,
        })