Add field for requesting photo consent
authorMagnus Hagander <magnus@hagander.net>
Mon, 11 Jun 2018 14:04:49 +0000 (16:04 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 11 Jun 2018 14:04:49 +0000 (16:04 +0200)
The field is optional and can be enabled on a per-conference basis. Once
enabled, it will be come mandatory for all registrations on that
conference.

postgresqleu/confreg/backendforms.py
postgresqleu/confreg/forms.py
postgresqleu/confreg/migrations/0024_photoconsent.py [new file with mode: 0644]
postgresqleu/confreg/models.py

index b893c4d61d00f04ba24d4c79b80ace17995e9ce7..ec599a1ef1cb756bc0400ac7dacdbe3ea978afd0 100644 (file)
@@ -110,8 +110,8 @@ class BackendConferenceForm(BackendForm):
                                  'conferencefeedbackopen', 'scheduleactive', 'sessionsactive',
                                  'schedulewidth', 'pixelsperminute',
                                  'testers', 'talkvoters', 'staff', 'volunteers',
-                                 'asktshirt', 'askfood', 'asknick', 'asktwitter', 'askshareemail', 'skill_levels',
-                                 'additionalintro', 'callforpapersintro', 'sendwelcomemail', 'welcomemail',
+                                 'asktshirt', 'askfood', 'asknick', 'asktwitter', 'askshareemail', 'askphotoconsent',
+                                 'skill_levels', 'additionalintro', 'callforpapersintro', 'sendwelcomemail', 'welcomemail',
                                  'invoice_autocancel_hours', 'attendees_before_waitlist']
        selectize_multiple_fields = ['testers', 'talkvoters', 'staff', 'volunteers']
 
index efe31a28ac5a67316cffacda2e9137e38de34255..21774f22ca2e7fd1b4ff7a3b614395dd32d004f5 100644 (file)
@@ -47,6 +47,10 @@ class ConferenceRegistrationForm(forms.ModelForm):
                        del self.fields['twittername']
                else:
                        self.fields['twittername'].validators.append(TwitterValidator)
+               if not self.instance.conference.askphotoconsent:
+                       del self.fields['photoconsent']
+               else:
+                       self.fields['photoconsent'].required = True
 
                if self.regforother:
                        self.fields['email'].widget.attrs['readonly'] = True
@@ -261,6 +265,9 @@ class ConferenceRegistrationForm(forms.ModelForm):
        class Meta:
                model = ConferenceRegistration
                exclude = ('conference','attendee','registrator','payconfirmedat','payconfirmedby','created', 'regtoken', )
+               widgets = {
+                       'photoconsent': forms.Select(choices=((None, ''), (True, 'I consent to having my photo taken'), (False, "I don't want my photo taken"))),
+               }
 
        @property
        def fieldsets(self):
@@ -287,6 +294,12 @@ class ConferenceRegistrationForm(forms.ModelForm):
                                   'legend': 'Conference information',
                                   'fields': fields}
 
+               if self.instance.conference.askphotoconsent:
+                       yield {'id': 'consent_info',
+                                  'legend': 'Consent',
+                                  'fields': [self[x] for x in ['photoconsent', ]],
+                       }
+
                if conf.conferenceadditionaloption_set.filter(public=True).exists():
                        yield {'id': 'additional_options',
                                   'legend': 'Additional options',
diff --git a/postgresqleu/confreg/migrations/0024_photoconsent.py b/postgresqleu/confreg/migrations/0024_photoconsent.py
new file mode 100644 (file)
index 0000000..e5c3553
--- /dev/null
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('confreg', '0023_accesstokens'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='conference',
+            name='askphotoconsent',
+            field=models.BooleanField(default=True, help_text=b'Include field for getting photo consent', verbose_name=b'Field: photo consent'),
+        ),
+        migrations.AddField(
+            model_name='conferenceregistration',
+            name='photoconsent',
+            field=models.NullBooleanField(verbose_name=b'Consent to having your photo taken at the event by the organisers'),
+        ),
+    ]
index 22a2508a612e1b31bb649c40ba09c71215233fe0..5f553363f929ea979a2168248b603f59b45a0545 100644 (file)
@@ -129,6 +129,7 @@ class Conference(models.Model):
        asktwitter = models.BooleanField(null=False, blank=False, default=False, verbose_name="Field: twitter name", help_text="Include field for twitter name")
        asknick = models.BooleanField(null=False, blank=False, default=False, verbose_name="Field: nick", help_text="Include field for nick")
        askshareemail = models.BooleanField(null=False, blank=False, default=False, verbose_name="Field: share email", help_text="Include field for sharing email with sponsors")
+       askphotoconsent = models.BooleanField(null=False, blank=False, default=True, verbose_name="Field: photo consent", help_text="Include field for getting photo consent")
        skill_levels = models.BooleanField(blank=False, null=False, default=True)
        additionalintro = models.TextField(blank=True, null=False, help_text="Additional text shown just before the list of available additional options")
        jinjadir = models.CharField(max_length=200, blank=True, null=True, default=None, help_text="Full path to new style jinja repository root")
@@ -413,6 +414,7 @@ class ConferenceRegistration(models.Model):
        twittername = models.CharField(max_length=100, null=False, blank=True, verbose_name="Twitter account")
        nick = models.CharField(max_length=100, null=False, blank=True, verbose_name="Nickname")
        shareemail = models.BooleanField(null=False, blank=False, default=False, verbose_name="Share e-mail address with sponsors")
+       photoconsent = models.NullBooleanField(null=True, blank=False, verbose_name="Consent to having your photo taken at the event by the organisers")
 
        # Admin fields!
        payconfirmedat = models.DateTimeField(null=True, blank=True, verbose_name="Payment confirmed")