Changeset - c82ad6c1181e
[Not reviewed]
0 1 1
Christopher Neugebauer - 7 years ago 2017-10-04 13:26:14
chrisjrn@gmail.com
Adds an agreement field to the profile
2 files changed with 35 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/migrations/0004_attendeeprofile_agreement.py
Show inline comments
 
new file 100644
 
# -*- 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 <a href='/code-of-conduct'>Code of Conduct</a>. I also agree with the North Bay Python <a href='/terms'>Terms and Conditions</a>.", verbose_name=b'Agreement'),
 
        ),
 
    ]
pinaxcon/registrasion/models.py
Show inline comments
...
 
@@ -34,48 +34,54 @@ class AttendeeProfile(rego.AttendeeProfileBase):
 
                self.address_postcode or "",
 
            ))
 

	
 
        if self.state:
 
            lines.append(self.state)
 

	
 
        if self.country:
 
            lines.append(self.country.name)
 

	
 
        return "\n".join(unicode(line) for line in lines)
 

	
 
    def clean(self):
 
        errors = []
 
        if self.country == "US" and not self.state:
 
            errors.append(
 
                ("state", "US-based attendees must list their state"),
 
            )
 

	
 
        if self.address_line_2 and not self.address_line_1:
 
            errors.append((
 
                "address_line_1",
 
                "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))
 

	
 
    def save(self):
 
        if not self.name_per_invoice:
 
            self.name_per_invoice = self.name
 
        super(AttendeeProfile, self).save()
 

	
 
    # Things that appear on badge
 
    name = models.CharField(
 
        verbose_name="Your name (for your conference nametag)",
 
        max_length=64,
 
        help_text="Your name, as you'd like it to appear on your badge. ",
 
    )
 

	
 
    company = models.CharField(
 
        max_length=64,
 
        help_text="The name of your company, as you'd like it on your badge and receipt",
 
        blank=True,
 
    )
 

	
 
    name_per_invoice = models.CharField(
 
        verbose_name="Your legal name (for your receipt)",
 
        max_length=256,
...
 
@@ -116,24 +122,33 @@ class AttendeeProfile(rego.AttendeeProfileBase):
 
    )
 

	
 
    dietary_restrictions = models.CharField(
 
        verbose_name="Food allergies, intolerances, or dietary restrictions",
 
        max_length=256,
 
        blank=True,
 
    )
 
    accessibility_requirements = models.CharField(
 
        verbose_name="Accessibility-related requirements",
 
        max_length=256,
 
        blank=True,
 
    )
 
    gender = models.CharField(
 
        help_text="Gender data will only be used for demographic purposes.",
 
        max_length=64,
 
        blank=True,
 
    )
 

	
 
    newsletter = models.BooleanField(
 
        verbose_name="Subscribe to North Bay Python newsletter",
 
        help_text="Select to be subscribed to the low-volume North Bay Python "
 
                  "announcements newsletter",
 
        blank=True,
 
    )
 

	
 
    agreement = models.BooleanField(
 
        verbose_name="Agreement",
 
        help_text="I agree to act according to the <a href='/code-of-conduct'> "
 
                  "North Bay Python Code of Conduct</a>. I also agree with the "
 
                  "North Bay Python <a href='/terms'>Terms and Conditions</a>.",
 
        blank=False,
 
        default=False,
 
    )
0 comments (0 inline, 0 general)