Fleshes out badge model, and adds first pass at display of the badge form
This commit is contained in:
parent
eb530bd485
commit
236c61eefa
9 changed files with 252 additions and 9 deletions
|
@ -57,6 +57,15 @@ def CategoryForm(category):
|
||||||
|
|
||||||
return _CategoryForm
|
return _CategoryForm
|
||||||
|
|
||||||
|
|
||||||
|
class ProfileForm(forms.ModelForm):
|
||||||
|
''' A form for requesting badge and profile information. '''
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = rego.BadgeAndProfile
|
||||||
|
exclude = ['attendee']
|
||||||
|
|
||||||
|
|
||||||
class VoucherForm(forms.Form):
|
class VoucherForm(forms.Form):
|
||||||
voucher = forms.CharField(
|
voucher = forms.CharField(
|
||||||
label="Voucher code",
|
label="Voucher code",
|
||||||
|
|
54
registrasion/migrations/0002_auto_20160323_2029.py
Normal file
54
registrasion/migrations/0002_auto_20160323_2029.py
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('registrasion', '0001_squashed_0002_auto_20160304_1723'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='accessibility_requirements',
|
||||||
|
field=models.CharField(max_length=256, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='dietary_requirements',
|
||||||
|
field=models.CharField(max_length=256, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='free_text_1',
|
||||||
|
field=models.CharField(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.", max_length=64, verbose_name='Free text line 1', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='free_text_2',
|
||||||
|
field=models.CharField(max_length=64, verbose_name='Free text line 2', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='gender',
|
||||||
|
field=models.CharField(max_length=64, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='of_legal_age',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='18+?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='badge',
|
||||||
|
name='company',
|
||||||
|
field=models.CharField(help_text="The name of your company, as you'd like it on your badge", max_length=64, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='badge',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(help_text="Your name, as you'd like it on your badge", max_length=64),
|
||||||
|
),
|
||||||
|
]
|
24
registrasion/migrations/0003_auto_20160323_2044.py
Normal file
24
registrasion/migrations/0003_auto_20160323_2044.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('registrasion', '0002_auto_20160323_2029'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='badge',
|
||||||
|
name='name_per_invoice',
|
||||||
|
field=models.CharField(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.", max_length=64, verbose_name='Your legal name (for invoicing purposes)', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='badge',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(help_text="Your name, as you'd like it to appear on your badge. ", max_length=64, verbose_name='Your name (for your conference nametag)'),
|
||||||
|
),
|
||||||
|
]
|
55
registrasion/migrations/0004_auto_20160323_2137.py
Normal file
55
registrasion/migrations/0004_auto_20160323_2137.py
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('registrasion', '0003_auto_20160323_2044'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Attendee',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('completed_registration', models.BooleanField(default=False)),
|
||||||
|
('highest_complete_category', models.IntegerField(default=0)),
|
||||||
|
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='BadgeAndProfile',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('name', models.CharField(help_text="Your name, as you'd like it to appear on your badge. ", max_length=64, verbose_name='Your name (for your conference nametag)')),
|
||||||
|
('company', models.CharField(help_text="The name of your company, as you'd like it on your badge", max_length=64, blank=True)),
|
||||||
|
('free_text_1', models.CharField(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.", max_length=64, verbose_name='Free text line 1', blank=True)),
|
||||||
|
('free_text_2', models.CharField(max_length=64, verbose_name='Free text line 2', blank=True)),
|
||||||
|
('name_per_invoice', models.CharField(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.", max_length=64, verbose_name='Your legal name (for invoicing purposes)', blank=True)),
|
||||||
|
('of_legal_age', models.BooleanField(default=False, verbose_name='18+?')),
|
||||||
|
('dietary_requirements', models.CharField(max_length=256, blank=True)),
|
||||||
|
('accessibility_requirements', models.CharField(max_length=256, blank=True)),
|
||||||
|
('gender', models.CharField(max_length=64, blank=True)),
|
||||||
|
('profile', models.OneToOneField(to='registrasion.Attendee')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='badge',
|
||||||
|
name='profile',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='profile',
|
||||||
|
name='user',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Badge',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Profile',
|
||||||
|
),
|
||||||
|
]
|
19
registrasion/migrations/0005_auto_20160323_2141.py
Normal file
19
registrasion/migrations/0005_auto_20160323_2141.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('registrasion', '0004_auto_20160323_2137'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='badgeandprofile',
|
||||||
|
old_name='profile',
|
||||||
|
new_name='attendee',
|
||||||
|
),
|
||||||
|
]
|
|
@ -15,29 +15,79 @@ from model_utils.managers import InheritanceManager
|
||||||
# User models
|
# User models
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Profile(models.Model):
|
class Attendee(models.Model):
|
||||||
''' Miscellaneous user-related data. '''
|
''' Miscellaneous user-related data. '''
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s" % self.user
|
return "%s" % self.user
|
||||||
|
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
# Badge is linked
|
# Badge/profile is linked
|
||||||
completed_registration = models.BooleanField(default=False)
|
completed_registration = models.BooleanField(default=False)
|
||||||
highest_complete_category = models.IntegerField(default=0)
|
highest_complete_category = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Badge(models.Model):
|
class BadgeAndProfile(models.Model):
|
||||||
''' Information for an attendee's badge. '''
|
''' Information for an attendee's badge and related preferences '''
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Badge for: %s of %s" % (self.name, self.company)
|
return "Badge for: %s of %s" % (self.name, self.company)
|
||||||
|
|
||||||
profile = models.OneToOneField(Profile, on_delete=models.CASCADE)
|
attendee = models.OneToOneField(Attendee, on_delete=models.CASCADE)
|
||||||
|
|
||||||
name = models.CharField(max_length=256)
|
# Things that appear on badge
|
||||||
company = models.CharField(max_length=256)
|
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",
|
||||||
|
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=64,
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
of_legal_age = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
verbose_name="18+?",
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
dietary_requirements = models.CharField(
|
||||||
|
max_length=256,
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
accessibility_requirements = models.CharField(
|
||||||
|
max_length=256,
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
gender = models.CharField(
|
||||||
|
max_length=64,
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Inventory Models
|
# Inventory Models
|
||||||
|
|
22
registrasion/templates/profile_form.html
Normal file
22
registrasion/templates/profile_form.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<!--- Sample template. Move elsewhere once it's ready to go. -->
|
||||||
|
|
||||||
|
{% extends "site_base.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<h1>Attendee Profile</h1>
|
||||||
|
|
||||||
|
<p>Something something fill in your attendee details here!</p>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<table>
|
||||||
|
{{ form }}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<input type="submit">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -2,10 +2,11 @@ from django.conf.urls import url, patterns
|
||||||
|
|
||||||
urlpatterns = patterns(
|
urlpatterns = patterns(
|
||||||
"registrasion.views",
|
"registrasion.views",
|
||||||
url(r"^register$", "guided_registration", name="guided_registration"),
|
|
||||||
url(r"^register/([0-9]+)$", "guided_registration", name="guided_registration"),
|
|
||||||
url(r"^category/([0-9]+)$", "product_category", name="product_category"),
|
url(r"^category/([0-9]+)$", "product_category", name="product_category"),
|
||||||
url(r"^checkout$", "checkout", name="checkout"),
|
url(r"^checkout$", "checkout", name="checkout"),
|
||||||
url(r"^invoice/([0-9]+)$", "invoice", name="invoice"),
|
url(r"^invoice/([0-9]+)$", "invoice", name="invoice"),
|
||||||
url(r"^invoice/([0-9]+)/pay$", "pay_invoice", name="pay_invoice"),
|
url(r"^invoice/([0-9]+)/pay$", "pay_invoice", name="pay_invoice"),
|
||||||
|
url(r"^profile$", "profile", name="profile"),
|
||||||
|
url(r"^register$", "guided_registration", name="guided_registration"),
|
||||||
|
url(r"^register/([0-9]+)$", "guided_registration", name="guided_registration"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,6 +38,15 @@ def guided_registration(request, page_id=0):
|
||||||
else:
|
else:
|
||||||
return redirect("dashboard")
|
return redirect("dashboard")
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def profile(request):
|
||||||
|
|
||||||
|
form = forms.ProfileForm()
|
||||||
|
data = {
|
||||||
|
"form": form,
|
||||||
|
}
|
||||||
|
return render(request, "profile_form.html", data)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def product_category(request, category_id):
|
def product_category(request, category_id):
|
||||||
ret = product_category_inner(request, category_id)
|
ret = product_category_inner(request, category_id)
|
||||||
|
|
Loading…
Reference in a new issue