From c82ad6c1181ea46c3d87ed2e19442cdf8ff61684 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Wed, 4 Oct 2017 06:26:00 -0700 Subject: [PATCH] Adds an agreement field to the profile --- .../0004_attendeeprofile_agreement.py | 20 +++++++++++++++++++ pinaxcon/registrasion/models.py | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pinaxcon/registrasion/migrations/0004_attendeeprofile_agreement.py diff --git a/pinaxcon/registrasion/migrations/0004_attendeeprofile_agreement.py b/pinaxcon/registrasion/migrations/0004_attendeeprofile_agreement.py new file mode 100644 index 0000000..10a4512 --- /dev/null +++ b/pinaxcon/registrasion/migrations/0004_attendeeprofile_agreement.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-10-04 13:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pinaxcon_registrasion', '0003_auto_20171002_1719'), + ] + + operations = [ + migrations.AddField( + model_name='attendeeprofile', + name='agreement', + field=models.BooleanField(default=False, help_text=b"I agree to act according to the conference Code of Conduct. I also agree with the North Bay Python Terms and Conditions.", verbose_name=b'Agreement'), + ), + ] diff --git a/pinaxcon/registrasion/models.py b/pinaxcon/registrasion/models.py index c8a2a1d..b09a981 100644 --- a/pinaxcon/registrasion/models.py +++ b/pinaxcon/registrasion/models.py @@ -55,6 +55,12 @@ class AttendeeProfile(rego.AttendeeProfileBase): "Please fill in line 1 before filling line 2", )) + if not self.agreement: + errors.append(( + "agreement", + "You must accept the agreement.", + )) + if errors: raise ValidationError(dict(errors)) @@ -137,3 +143,12 @@ class AttendeeProfile(rego.AttendeeProfileBase): "announcements newsletter", blank=True, ) + + agreement = models.BooleanField( + verbose_name="Agreement", + help_text="I agree to act according to the " + "North Bay Python Code of Conduct. I also agree with the " + "North Bay Python Terms and Conditions.", + blank=False, + default=False, + )