From: Magnus Hagander Date: Mon, 11 Jun 2018 14:04:49 +0000 (+0200) Subject: Add field for requesting photo consent X-Git-Tag: FINAL_PY2~303 X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpgdulink%28?a=commitdiff_plain;h=f040afafce92296d9207d9b78909969b58d5f3b1;p=pgeu-web.git Add field for requesting photo consent 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. --- diff --git a/postgresqleu/confreg/backendforms.py b/postgresqleu/confreg/backendforms.py index b893c4d..ec599a1 100644 --- a/postgresqleu/confreg/backendforms.py +++ b/postgresqleu/confreg/backendforms.py @@ -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'] diff --git a/postgresqleu/confreg/forms.py b/postgresqleu/confreg/forms.py index efe31a2..21774f2 100644 --- a/postgresqleu/confreg/forms.py +++ b/postgresqleu/confreg/forms.py @@ -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 index 0000000..e5c3553 --- /dev/null +++ b/postgresqleu/confreg/migrations/0024_photoconsent.py @@ -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'), + ), + ] diff --git a/postgresqleu/confreg/models.py b/postgresqleu/confreg/models.py index 22a2508..5f55336 100644 --- a/postgresqleu/confreg/models.py +++ b/postgresqleu/confreg/models.py @@ -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")