Add promotional fields to conference and series
authorMagnus Hagander <magnus@hagander.net>
Sun, 2 Sep 2018 17:30:23 +0000 (19:30 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sun, 2 Sep 2018 17:30:23 +0000 (19:30 +0200)
This adds field to enable/disable promotion of a conference, along with
a text and an image field for it. It also adds an intro text to
conference series, as they are now used to promote events.

docs/confreg/configuring.md
docs/confreg/series.md
postgresqleu/confreg/backendforms.py
postgresqleu/confreg/migrations/0027_confpromo.py [new file with mode: 0644]
postgresqleu/confreg/models.py

index 73f71358e2e89cf148feb038596fece5b00206ee..d996a30e520d20da7fb9ed641b25d59bb8bc933e 100644 (file)
@@ -120,6 +120,21 @@ Additionalintro
 additional options. Typically introduces what the additional options
 are. Can contain markdown.
 
+Promotion active
+: Should this conference be listed in promotional parts of the website.
+Without this, the only way to access the conference information is to
+know the URL for it.
+
+Promotion text
+: Short text (supports markdown) with information about the conference,
+which is use din promotional pages on the main website.
+
+URL to promo picture
+: An URL pointing to a picture promoting this event, which will be
+used on the main website. If left blank a default (or random)
+picture will be used. Picture must have an aspect ratio of 2.3, but
+wil lotherwise be reasonably sized to fit the screen of the visitors.
+
 Field t-shirt
 : Should the field asking for t-shirt size be displayed on
 registration form. Only used if t-shirts are given out.
index d5ccea2edf5b5adf1c7bc7e7abdb8515fa42d78d..d207b7d158188c89aae2b80c3e8fdff1bb931bdb 100644 (file)
@@ -5,4 +5,5 @@ runs across multiple instances. For example, "PGConf.EU" is a series
 and "PGConf.EU 2018" is an instance.
 
 Conference series are primarily used for the
-[e-mail opt-out](emails#optout) functionality.
+[e-mail opt-out](emails#optout) functionality and for providing
+introductory information on the main website.
index 3fd65c2bf16c86a9e1925155c0cc8687a8bafd1a..c6c9ee39111b79042667ab471ae0d39ca60ab19b 100644 (file)
@@ -156,6 +156,7 @@ class BackendConferenceForm(BackendForm):
                model = Conference
                fields = ['active', 'callforpapersopen', 'callforsponsorsopen', 'feedbackopen',
                                  'conferencefeedbackopen', 'scheduleactive', 'sessionsactive', 'allowedit',
+                                 'promoactive', 'promotext', 'promopicurl',
                                  'schedulewidth', 'pixelsperminute',
                                  'testers', 'talkvoters', 'staff', 'volunteers',
                                  'asktshirt', 'askfood', 'asknick', 'asktwitter', 'askshareemail', 'askphotoconsent',
@@ -173,6 +174,7 @@ class BackendConferenceForm(BackendForm):
 
        fieldsets = [
                {'id': 'base_info', 'legend': 'Basic information', 'fields': ['attendees_before_waitlist', 'invoice_autocancel_hours', 'sendwelcomemail', 'welcomemail', 'additionalintro']},
+               {'id': 'promo', 'legend': 'Website promotion', 'fields': ['promoactive', 'promotext', 'promopicurl']},
                {'id': 'fields', 'legend': 'Registration fields', 'fields': [ 'asktshirt', 'askfood', 'asknick', 'asktwitter', 'askshareemail', 'askphotoconsent']},
                {'id': 'steps', 'legend': 'Steps', 'fields': ['active', 'allowedit', 'callforpapersopen', 'callforsponsorsopen', 'scheduleactive', 'sessionsactive', 'conferencefeedbackopen', 'feedbackopen']},
                {'id': 'callforpapers', 'legend': 'Call for papers', 'fields': ['skill_levels', 'callforpapersintro']},
@@ -207,10 +209,10 @@ class BackendSuperConferenceForm(BackendForm):
 
 class BackendConferenceSeriesForm(BackendForm):
        helplink = "series"
-       list_fields = ['name', ]
+       list_fields = ['name', 'sortkey', ]
        class Meta:
                model = ConferenceSeries
-               fields = ['name', ]
+               fields = ['name', 'sortkey', 'intro', ]
 
 class BackendRegistrationForm(BackendForm):
        helplink = "registrations"
diff --git a/postgresqleu/confreg/migrations/0027_confpromo.py b/postgresqleu/confreg/migrations/0027_confpromo.py
new file mode 100644 (file)
index 0000000..b1f873f
--- /dev/null
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2018-08-31 15:11
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import postgresqleu.util.validators
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('confreg', '0026_sessionvote_comment_text'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='conferenceseries',
+            options={'ordering': ('sortkey', 'name')},
+        ),
+        migrations.AddField(
+            model_name='conference',
+            name='promoactive',
+            field=models.BooleanField(default=False, verbose_name=b'Promotion active'),
+        ),
+        migrations.AddField(
+            model_name='conference',
+            name='promopicurl',
+            field=models.URLField(blank=True, validators=[postgresqleu.util.validators.PictureUrlValidator(aspect=2.3)], verbose_name=b'URL to promo picture'),
+        ),
+        migrations.AddField(
+            model_name='conference',
+            name='promotext',
+            field=models.TextField(blank=True, max_length=1000, verbose_name=b'Promotion text'),
+        ),
+        migrations.AddField(
+            model_name='conferenceseries',
+            name='intro',
+            field=models.TextField(blank=True),
+        ),
+        migrations.AddField(
+            model_name='conferenceseries',
+            name='sortkey',
+            field=models.IntegerField(default=100),
+        ),
+    ]
index 117673b3160c283350b798e91d6ca00843dfa843..b7e0cf4a4f34c474d55b1aa3f49bcbe23fa605a9 100644 (file)
@@ -12,6 +12,7 @@ from django.contrib.postgres.fields import DateTimeRangeField
 
 from postgresqleu.util.validators import validate_lowercase
 from postgresqleu.util.validators import TwitterValidator
+from postgresqleu.util.validators import PictureUrlValidator
 from postgresqleu.util.forms import ChoiceArrayField
 
 from postgresqleu.confreg.dbimage import SpeakerImageStorage
@@ -70,10 +71,15 @@ def color_validator(value):
 
 class ConferenceSeries(models.Model):
        name = models.CharField(max_length=64, blank=False, null=False)
+       sortkey = models.IntegerField(null=False, default=100)
+       intro = models.TextField(blank=True, null=False)
 
        def __unicode__(self):
                return self.name
 
+       class Meta:
+               ordering = ('sortkey', 'name')
+
 class ConferenceSeriesOptOut(models.Model):
        # Users opting out of communications about a specific conference
        series = models.ForeignKey(ConferenceSeries, null=False, blank=False)
@@ -95,6 +101,9 @@ class Conference(models.Model):
        startdate = models.DateField(blank=False, null=False, verbose_name="Start date")
        enddate = models.DateField(blank=False, null=False, verbose_name="End date")
        location = models.CharField(max_length=128, blank=False, null=False)
+       promoactive = models.BooleanField(default=False, verbose_name="Promotion active")
+       promopicurl = models.URLField(blank=True, null=False, verbose_name="URL to promo picture", validators=[PictureUrlValidator(aspect=2.3)])
+       promotext = models.TextField(null=False, blank=True, max_length=1000, verbose_name="Promotion text")
        timediff = models.IntegerField(null=False, blank=False, default=0)
        contactaddr = models.EmailField(blank=False,null=False, verbose_name="Contact address")
        sponsoraddr = models.EmailField(blank=False,null=False, verbose_name="Sponsor address")