Changeset - 31c265a6b841
[Not reviewed]
0 3 0
Joel Addison - 3 years ago 2021-11-27 06:36:16
joel@addison.net.au
Adjust attendee profile
3 files changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/forms.py
Show inline comments
 
from pinaxcon.registrasion import models
 

	
 
from django import forms
 

	
 

	
 
class YesNoField(forms.TypedChoiceField):
 

	
 
    def __init__(self, *args, **kwargs):
 
        kwargs['required'] = True
 
        super(YesNoField, self).__init__(
 
            *args,
 
            coerce=lambda x: x in ['True', 'Yes', True],
 
            choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
 
            **kwargs
 
        )
 

	
 

	
 
class ProfileForm(forms.ModelForm):
 
    ''' A form for requesting badge and profile information. '''
 

	
 
    required_css_class = 'label-required'
 

	
 
    class Meta:
 
        model = models.AttendeeProfile
 
        exclude = [
 
            'attendee',
 
            'of_legal_age',
 
            'dietary_restrictions',
 
            'children',
 
            'lca_chat',
 
            'future_conference',
 
        ]
 
        widgets = {
 
            'past_lca': forms.widgets.CheckboxSelectMultiple
 
        }
 
        field_classes = {
 
            "of_legal_age": YesNoField,
 
        }
pinaxcon/registrasion/models.py
Show inline comments
 
from textwrap import wrap
 
from django.core.exceptions import ValidationError
 
from django.db import models
 
from django.utils.encoding import python_2_unicode_compatible
 
from django_countries.fields import CountryField
 
from registrasion import models as rego
 

	
 
@python_2_unicode_compatible
 
class PastEvent(models.Model):
 
    ''' This is populated in 0001_initial.py '''
 

	
 
    def __str__(self):
 
        return self.name
 

	
 
    year = models.IntegerField(unique=True,)
 
    name = models.CharField(max_length=255, unique=True,)
 

	
 

	
 
class AttendeeProfile(rego.AttendeeProfileBase):
 

	
 
    @classmethod
 
    def name_field(cls):
 
        ''' This is used to pre-fill the attendee's name from the
 
        speaker profile. If it's None, that functionality is disabled. '''
 
        return "name"
 

	
 
    def invoice_recipient(self):
 

	
 
        lines = [
 
            self.name_per_invoice,
 
        ]
 

	
 
        if self.company:
 
            lines.append("C/- " + self.company)
 

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

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

	
 
        if self.address_suburb or self.address_postcode:
 
            lines.append("%s %s" % (
 
                self.address_suburb or "",
 
                self.address_postcode or "",
 
            ))
 

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

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

	
 
        return "\n".join(lines)
 

	
 
    def clean(self):
 
        errors = []
 
        if self.country == "AU" and not self.state:
 
            errors.append(
 
                ("state", "Australians 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 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(
 
        verbose_name="Company",
 
        max_length=64,
 
        help_text="The name of your company, as you'd like it on your badge",
 
        blank=True,
 
    )
 

	
 
    free_text_1 = models.CharField(
 
        max_length=64,
 
        verbose_name="Free text line 1",
 
        help_text="A line of free text that will appear on your badge. Use "
 
                  "this for your Twitter handle, IRC nick, your preferred "
 
                  "pronouns or anything else you'd like people to see on "
 
                  "your badge.",
 
        blank=True,
 
    )
 
    free_text_2 = models.CharField(
 
        max_length=64,
 
        verbose_name="Free text line 2",
 
        blank=True,
 
    )
 

	
 
    # Other important Information
 
    name_per_invoice = models.CharField(
 
        verbose_name="Your legal name (for invoicing purposes)",
 
        max_length=256,
 
        help_text="If your legal name is different to the name on your badge, "
 
                  "fill this in, and we'll put it on your invoice. Otherwise, "
 
                  "leave it blank.",
 
        blank=True,
 
        )
 

	
 
    address_line_1 = models.CharField(
 
        verbose_name="Address line 1",
 
        help_text="This address, if provided, will appear on your invoices. "
 
                  "It is also where we will ship your Swag Badge "
 
                  "if you are allocated one.",
 
        max_length=1024,
 
        blank=True,
 
    )
 
    address_line_2 = models.CharField(
 
        verbose_name="Address line 2",
 
        max_length=1024,
 
        blank=True,
 
    )
 
    address_suburb = models.CharField(
 
        verbose_name="City/Town/Suburb",
 
        max_length=1024,
 
        blank=True,
 
    )
 
    address_postcode = models.CharField(
 
        verbose_name="Postal/Zip code",
 
        max_length=1024,
 
        blank=True,
 
    )
 
    country = CountryField(
 
        verbose_name="Country",
 
        default="AU",
 
    )
 
    state = models.CharField(
 
        max_length=256,
 
        verbose_name="State/Territory/Province",
 
        help_text="If your Country is Australia, you must list a state.",
 
        blank=True,
 
    )
 

	
 
    of_legal_age = models.BooleanField(
 
        verbose_name="Are you over 18?",
 
        help_text="Being under 18 will not stop you from attending the "
 
                  "conference. We need to know whether you are over 18 to "
 
                  "allow us to cater for you at venues that serve alcohol.",
 
        blank=True, # LCA2022 - not needed.
 
        blank=True,
 
        default=False,
 
    )
 
    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(
 
        verbose_name="Gender",
 
        help_text="Gender data will only be used for demographic purposes.",
 
        max_length=64,
 
        blank=True,
 
    )
 

	
 
    children = models.CharField(
 
        verbose_name="Child Ages and Information",
 
        max_length=256,
 
        help_text="Linux.conf.au is a family friendly conference and provides "
 
            "free child-care for pre-school children from 6 months up to 5 years. We "
 
            "hope to also provide a programme for older children and will let you "
 
            "know closer to the conference. If you're wanting to bring your children "
 
            "to LCA, please let us know their age(s) so we can ensure we have "
 
            "enough spaces available.",
 
        blank=True
 
    )
 

	
 
    linux_australia = models.BooleanField(
 
        verbose_name="Linux Australia membership",
 
        help_text="Select this field to register for free "
 
                  "<a href='http://www.linux.org.au/'>Linux Australia</a> "
 
                  "membership.",
 
        blank=True,
 
    )
 

	
 
    lca_announce = models.BooleanField(
 
        verbose_name="Subscribe to lca-announce list",
 
        help_text="Select to be subscribed to the low-traffic lca-announce "
 
                  "mailing list",
 
        blank=True,
 
    )
 

	
 
    lca_chat = models.BooleanField(
 
        verbose_name="Subscribe to the LCA chat list",
 
        help_text="lca-chat is a high-traffic mailing list used by "
 
                  "attendees during the week of the conference for general "
 
                  "discussion.",
 
        blank=True,
 
    )
 

	
 
    future_conference = models.BooleanField(
 
        verbose_name = "Reuse my login for future Linux Australia conferences?",
 
        help_text="Select to have your login details made available to future "
 
                  "Linux Australia conferences who share the same Single Sign "
 
                  "On system.",
 
        blank=True,
 
        default=False,
 
    )
 

	
 
    past_lca = models.ManyToManyField(
 
        PastEvent,
 
        verbose_name="Which past linux.conf.au events have you attended?",
 
        blank=True,
 
    )
 

	
 
    def first_name(self):
 
        return wrap(self.name, 15, break_long_words=False)[0]
 

	
 
    def last_name(self):
 
        names = wrap(self.name, 15, break_long_words=False)
 
        return names[1] if len(names) > 1 else ''
vendor/regidesk/regidesk/templates/regidesk/ci_overview.html
Show inline comments
 
{% extends "regidesk/base.html" %}
 

	
 
{% block head_title %}Checkin - {{ user.attendee.attendeeprofilebase.attendeeprofile.name }}{% endblock head_title %}
 
{% block page_title %}Pre-print check{% endblock page_title %}
 

	
 
{% block body %}
 
{% load registrasion_tags %}
 
{% load lca2018_tags %}
 
{% items_purchased as purchased %}
 
{% items_pending as pending %}
 
{% items_purchased 1 as ticket %}
 
<!-- {% items_purchased 6 as shirts %} -->
 
<!-- {% total_items_purchased 3 as penguin_dinner_count %} -->
 
<!-- {% total_items_purchased 4 as speakers_dinner_count %} -->
 
<!-- {% total_items_purchased 5 as pdns_count %} -->
 
{% ticket_type as ticket_type %}
 

	
 
<a type="button" class="btn btn-outline-primary" href="{% url 'regidesk:check_in_scanner' %}">Return to scanning page</a>
 

	
 
<div class="card my-3">
 
    <div class="card-header">Content Check</div>
 
    <div class="card-body">
 
        <dl class="card-text row">
 
            <dt class="col-sm-3">Ticket type</dt>
 
            <dd class="col-sm-9">{{ ticket_type }}</dd>
 

	
 
            <dt class="col-sm-3">Name</dt>
 
            <dd class="col-sm-9">{{ user.attendee.attendeeprofilebase.attendeeprofile.name }}</dd>
 

	
 
            <dt class="col-sm-3">Company</dt>
 
            <dd class="col-sm-9">{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</dd>
 

	
 
            <dt class="col-sm-3">Free Text 1</dt>
 
            <dd class="col-sm-9">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1 }}</dd>
 

	
 
            <dt class="col-sm-3">Free Text 2</dt>
 
            <dd class="col-sm-9">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2 }}</dd>
 

	
 
            {% comment "Not needed for LCA2022 online" %}
 
            <dt class="col-sm-3">Penguin Dinner Tickets</dt>
 
            <dd class="col-sm-9">{{ penguin_dinner_count }}</dd>
 

	
 
            <dt class="col-sm-3">Speaker Dinner Tickets</dt>
 
            <dd class="col-sm-9">{{ speakers_dinner_count }}</dd>
 

	
 
            <dt class="col-sm-3">PDNS Tickets</dt>
 
            <dd class="col-sm-9">{{ pdns_count }}</dd>
 
            {% endcomment %}
 

	
 
            <dt class="col-sm-3">Over 18 years</dt>
 
            <dd class="col-sm-9">{% if user.attendee.attendeeprofilebase.attendeeprofile.of_legal_age %}Yes{% else %}<strong class="red">NO</strong>{% endif %}</dd>
 
            {% endcomment %}
 

	
 
            <dt class="col-sm-3">Username</dt>
 
            <dd class="col-sm-9">{{ user.username }}</dd>
 
        </dl>
 

	
 
        {% comment "Not needed for LCA2022 online" %}
 
        <h4>Shirts ordered</h4>
 
        <table class="table card-text">
 
            {% for shirt in shirts%}
 
            <tr>
 
                <td>{{ shirt.product }}</td>
 
                <td>{{ shirt.quantity }}</td>
 
            </tr>
 
            {% endfor %}
 
        </table>
 
        {% endcomment %}
 
    </div>
 
</div>
 

	
 
<div class="card my-3">
 
    <div class="card-header">Venueless</div>
 
    <div class="card-body">
 
        <dl class="card-text row">
 
            <dt class="col-sm-3">User Id</dt>
 
            <dd class="col-sm-9">{{ check_in.venueless_user_id }}</dd>
 

	
 
            <dt class="col-sm-3">Traits</dt>
 
            <dd class="col-sm-9">{{ check_in.venueless_traits }}</dd>
 

	
 
            <dt class="col-sm-3">Token</dt>
 
            <dd class="col-sm-9">{{ check_in.venueless_token|truncatechars:20 }}</dd>
 
        </dl>
 
    </div>
 
</div>
 

	
 
<div class="card my-3">
 
    <div class="card-header">Badge Preview</div>
 
    <div class="card-body">
 
        <img src="{% url 'badge' user.id %}.png" style="max-width: 500px;">
 
    </div>
 
</div>
 

	
 
<div class="card {% if check_in.checked_in_bool %}border-danger{% else %}border-success{% endif %} my-3">
 
    <div class="card-header {% if check_in.checked_in_bool %}text-white bg-success{% endif %}">Check In</div>
 
    <div class="card-body">
 
        <dl class="row card-text">
 
            <dt class="col-sm-3">Status</dt>
 
            <dd class="col-sm-9">{% if check_in.checked_in_bool %}Checked in{% else %}Not checked in{% endif %}</dd>
 
        </dl>
 
        <p>If an attendee sees an error with their contents, please instruct them to change their profile and come back before checking them in.</p>
 
        <p>The attendee will be unable to edit their profile after they have been checked in.</p>
 
        <form method="post">
 
            <input type="checkbox" name="checkin" value="checkin" checked hidden>
 
            <input class="btn {% if check_in.checked_in_bool %}btn-warning{% else %}btn-primary{% endif %}" type="submit" value="Check In">
 
        </form>
 
    </div>
 
</div>
 

	
 
<div class="card {% if check_in.badge_printed %}border-success{% else %}border-danger{% endif %} my-3">
 
    <div class="card-header {% if check_in.badge_printed %}text-white bg-success{% endif %}">Badge</div>
 
    <div class="card-body">
 
        <dl class="row card-text">
 
            <dt class="col-sm-3">Status</dt>
 
            <dd class="col-sm-9">{% if check_in.badge_printed %}Marked{% else %}Not marked{% endif %} as printed</dd>
 
        </dl>
 
        <form method="post" class="d-inline-block">
 
            <input type="checkbox" name="badge" value="badge" checked hidden>
 
            <input class="btn btn-secondary" type="submit" value="Mark Badge as Printed">
 
        </form>
 
        <form method="post" class="d-inline-block">
 
            <input type="checkbox" name="unbadge" value="unbadge" checked hidden>
 
            <input class="btn btn-danger pull-right" type="submit" value="Reprint Badge">
 
        </form>
 
        <p class="d-inline-block">
 
            <a class="btn btn-outline-info" href="{% url 'badge_print' user.id %}" target="_blank">Preview Badge for Printing</a>
 
        </p>
 
    </div>
 
</div>
 

	
 
{% comment "Not needed for LCA2022 online" %}
 
<div class="card {% if check_in.schwag_given %}border-success{% else %}border-danger{% endif %} my-3">
 
    <div class="card-header {% if check_in.schwag_given %}text-white bg-success{% endif %}">Schwag</div>
 
    <div class="card-body">
 
        <dl class="row card-text">
 
            <dt class="col-sm-3">Status</dt>
 
            <dd class="col-sm-9">{% if check_in.schwag_given %}Marked{% else %}Not marked{% endif %} as given</dd>
 
        </dl>
 
        <form method="post">
 
            <input type="checkbox" name="schwag" value="schwag" checked hidden>
 
            <input class="btn {% if check_in.schwag_given %}btn-warning{% else %}btn-primary{% endif %}" type="submit" value="Give Schwag">
 
        </form>
 
    </div>
 
</div>
 
{% endcomment %}
 

	
 
<div class="card my-3">
 
    <div class="card-header">Log Exception</div>
 
    <div class="card-body">
 
        <form method="post" class="card-text">
 
            <textarea class="form-control" rows="3" name="exception">{{ check_in.review_text }}</textarea>
 
            <p class="help-block">Reminder: Please tell attendee to email the conference team with the details as well.</p>
 
            <input class="btn btn-primary" type="submit" value="Log Information">
 
        </form>
 
    </div>
 
</div>
 

	
 
{% comment "Not needed for LCA2022 online" %}
 
<div class="card my-3 {% if check_in.checked_in_bool and check_in.schwag_given %}border-success{% elif check_in.checked_in_bool or check_in.schwag_given %}card-warning{% else %}card-danger{% endif %}">
 
    <div class="card-header {% if check_in.checked_in_bool and check_in.schwag_given %}text-white bg-success{% elif check_in.checked_in_bool or check_in.schwag_given %}bg-warning{% endif %}">Bulk actions</div>
 
    <div class="card-body">
 
        <p>Mark attendee as checked in and schwag given</p>
 
        <dl class="row card-text">
 
            <dt class="col-sm-3">Status</dt>
 
            <dd class="col-sm-9">
 
                {% if check_in.checked_in_bool or check_in.schwag_given %}
 
                One of the items in bulk action is marked as given already
 
                {% else %}
 
                Both items are marked as unreceived
 
                {% endif %}
 
            </dd>
 
        </dl>
 
        <form method="post">
 
            <input type="checkbox" name="bulk" value="bulk" checked hidden>
 
            <input class="btn btn-primary" type="submit" value="Check In and Give Schwag">
 
        </form>
 
    </div>
 
</div>
 
{% endcomment %}
 

	
 
<a type="button" class="btn btn-outline-primary" href="{% url 'regidesk:check_in_scanner' %}">Return to scanning page</a>
 

	
 
{% endblock %}
0 comments (0 inline, 0 general)