symposion_app/vendor/regidesk/regidesk/migrations/0001_initial.py
James Polley e726ff21a8 Create regidesk app
Shows summary of all attendees with a paid ticket, including
boarding_pass status.

Currently, regidesk allows staff with the requisite permission the
ability to view the checkin status of attendees, and email the user
their boarding pass email.

Included is a view for the user to retrieve their own QR code (in case
they got the plain-text version of the email, they can use this to
download an image to their phone for faster checkin)
2018-01-06 11:38:06 +11:00

99 lines
4.8 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-06 00:19
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
def create_lca2018_template(apps, schema_editor):
BoardingPassTemplate = apps.get_model("regidesk", "BoardingPassTemplate")
body = ("This is the plain text version of your boarding pass for "
"linux.conf.au 2018.\r\n\r\nWhen you check in at LCA, you'll "
"need to show the QR code you can download from "
"{{ qrcode_url }}, or quote registration code: {{ code }} ")
html = ("<html>\r\n <body>\r\n <p>This is your boarding "
"pass</p>\r\n <p>A copy of the QR Code is required "
"for check in, please bring this email on either your "
"phone or on a print out.</p>\r\n "
"<p><img src=\"data:image/png;base64,{{ qrcode }}\" /></p>\r\n"
" <p>Backup Code: {{ code }}</p>\r\n </body>\r\n</html>")
template = BoardingPassTemplate(label="LCA2018",
from_address="team@lca2018.org",
subject="Your boarding pass for LCA2018, "
"{{ user.attendee.attendeeprofilebase.attendeeprofile.name }}",
body=body,
html_body=html)
template.save()
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='BoardingPass',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
('sent', models.DateTimeField(null=True, verbose_name='Sent')),
('to_address', models.EmailField(max_length=254, verbose_name='To address')),
('from_address', models.EmailField(max_length=254, verbose_name='From address')),
('subject', models.CharField(max_length=255, verbose_name='Subject')),
('body', models.TextField(verbose_name='Body')),
('html_body', models.TextField(null=True, verbose_name='HTML Body')),
],
options={
'permissions': (('view_boarding_pass', 'Can view sent boarding passes'), ('send_boarding_pass', 'Can send boarding passes')),
},
),
migrations.CreateModel(
name='BoardingPassTemplate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('label', models.CharField(max_length=100, verbose_name='Label')),
('from_address', models.EmailField(max_length=254, verbose_name='From address')),
('subject', models.CharField(max_length=100, verbose_name='Subject')),
('body', models.TextField(verbose_name='Body')),
('html_body', models.TextField(null=True, verbose_name='HTML Body')),
],
options={
'verbose_name': 'Boarding Pass template',
'verbose_name_plural': 'Boarding Pass templates',
},
),
migrations.CreateModel(
name='CheckIn',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('seen', models.DateTimeField(blank=True, null=True)),
('checked_in', models.DateTimeField(blank=True, null=True)),
('checkin_code', models.CharField(db_index=True, max_length=6, unique=True)),
('_checkin_code_png', models.TextField(blank=True, max_length=512, null=True)),
('boardingpass', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='regidesk.BoardingPass')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'permissions': (('view_checkin_details', "Can view the details of other user's checkins"),),
},
),
migrations.AddField(
model_name='boardingpass',
name='template',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='regidesk.BoardingPassTemplate', verbose_name='Template'),
),
migrations.RunPython(
code=create_lca2018_template,
),
]