If no boardingpass, make one
- Use the first template in the system - If there's no template, use /tickets/review as it at least gives - people an overview of what they've paid for and warns them of missing categories
This commit is contained in:
parent
0bb2f8c25d
commit
7d18387670
2 changed files with 58 additions and 38 deletions
|
@ -36,6 +36,8 @@
|
||||||
you check out:<p>
|
you check out:<p>
|
||||||
{% include "registrasion/_items_list.html" with items=pending %}
|
{% include "registrasion/_items_list.html" with items=pending %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
<h3>Previously purchased</h3>
|
||||||
{% items_purchased as purchased %}
|
{% items_purchased as purchased %}
|
||||||
{% if purchased %}
|
{% if purchased %}
|
||||||
<p>You've already paid for the following items:</p>
|
<p>You've already paid for the following items:</p>
|
||||||
|
@ -70,6 +72,7 @@
|
||||||
|
|
||||||
<h3>What next?</h3>
|
<h3>What next?</h3>
|
||||||
|
|
||||||
|
{% if pending %}
|
||||||
<p>You can either check out an invoice and pay for your selections, or return to
|
<p>You can either check out an invoice and pay for your selections, or return to
|
||||||
the dashboard.</p>
|
the dashboard.</p>
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@
|
||||||
<a class="btn btn-success" href="{% url "checkout" %}">
|
<a class="btn btn-success" href="{% url "checkout" %}">
|
||||||
<i class="fa fa-credit-card"></i> Check out and pay
|
<i class="fa fa-credit-card"></i> Check out and pay
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="btn btn-primary" href="{% url "dashboard" %}">Return to dashboard</a>
|
<a class="btn btn-primary" href="{% url "dashboard" %}">Return to dashboard</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
62
vendor/regidesk/regidesk/views.py
vendored
62
vendor/regidesk/regidesk/views.py
vendored
|
@ -41,8 +41,14 @@ def boardingpass(request):
|
||||||
user=request.user
|
user=request.user
|
||||||
checkin = CheckIn.objects.get_or_create(user=user)[0]
|
checkin = CheckIn.objects.get_or_create(user=user)[0]
|
||||||
if not checkin.boardingpass:
|
if not checkin.boardingpass:
|
||||||
messages.add_message(request, messages.WARNING, 'Your boarding pass has not been prepared. Please try again later.')
|
templates = BoardingPassTemplate.objects.all()
|
||||||
return redirect('/')
|
if not templates:
|
||||||
|
messages.add_message(request, messages.WARNING,
|
||||||
|
'Your boarding pass has not been prepared and I can\'t find a '
|
||||||
|
'default template to use. This page has similar information to '
|
||||||
|
'the boarding pass - please check back later.')
|
||||||
|
return redirect('/tickets/review')
|
||||||
|
prepare_boarding_pass(request, templates[0])
|
||||||
|
|
||||||
boardingpass = checkin.boardingpass.html_body
|
boardingpass = checkin.boardingpass.html_body
|
||||||
qrcode_url = request.build_absolute_uri(reverse("regidesk:checkin_png", args=[checkin.code]))
|
qrcode_url = request.build_absolute_uri(reverse("regidesk:checkin_png", args=[checkin.code]))
|
||||||
|
@ -170,27 +176,13 @@ def boarding_prepare(request):
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@permission_required("regidesk.send_boarding_pass")
|
def prepare_boarding_pass(request, template, attendee=None):
|
||||||
def boarding_send(request):
|
|
||||||
|
|
||||||
BOARDING_GROUP = getattr(settings, "REGIDESK_BOARDING_GROUP", None)
|
|
||||||
if BOARDING_GROUP and Group.objects.filter(name=BOARDING_GROUP):
|
|
||||||
boarding_users = User.objects.filter(groups__name=BOARDING_GROUP)
|
|
||||||
else:
|
|
||||||
boarding_users = User.objects.all()
|
|
||||||
|
|
||||||
attendees = people.Attendee.objects.filter(pk__in=request.session['boarding_attendees'])
|
|
||||||
attendees = attendees.select_related(
|
|
||||||
"user", "attendeeprofilebase", "attendeeprofilebase__attendeeprofile")
|
|
||||||
|
|
||||||
logging.debug(attendees)
|
|
||||||
|
|
||||||
template_pk = request.session['template']
|
|
||||||
template = BoardingPassTemplate.objects.get(pk=template_pk)
|
|
||||||
|
|
||||||
for attendee in attendees:
|
|
||||||
|
|
||||||
|
if attendee:
|
||||||
user = attendee.user
|
user = attendee.user
|
||||||
|
else:
|
||||||
|
user = request.user
|
||||||
|
attendee=user.attendee
|
||||||
checkin = CheckIn.objects.get_or_create(user=user)
|
checkin = CheckIn.objects.get_or_create(user=user)
|
||||||
ctx = {
|
ctx = {
|
||||||
"user": user,
|
"user": user,
|
||||||
|
@ -225,6 +217,30 @@ def boarding_send(request):
|
||||||
user.checkin.boardingpass = bpass
|
user.checkin.boardingpass = bpass
|
||||||
user.checkin.save()
|
user.checkin.save()
|
||||||
|
|
||||||
|
return body, html_body
|
||||||
|
|
||||||
|
@permission_required("regidesk.send_boarding_pass")
|
||||||
|
def boarding_send(request):
|
||||||
|
|
||||||
|
BOARDING_GROUP = getattr(settings, "REGIDESK_BOARDING_GROUP", None)
|
||||||
|
if BOARDING_GROUP and Group.objects.filter(name=BOARDING_GROUP):
|
||||||
|
boarding_users = User.objects.filter(groups__name=BOARDING_GROUP)
|
||||||
|
else:
|
||||||
|
boarding_users = User.objects.all()
|
||||||
|
|
||||||
|
attendees = people.Attendee.objects.filter(pk__in=request.session['boarding_attendees'])
|
||||||
|
attendees = attendees.select_related(
|
||||||
|
"user", "attendeeprofilebase", "attendeeprofilebase__attendeeprofile")
|
||||||
|
|
||||||
|
logging.debug(attendees)
|
||||||
|
|
||||||
|
template_pk = request.session['template']
|
||||||
|
template = BoardingPassTemplate.objects.get(pk=template_pk)
|
||||||
|
|
||||||
|
for attendee in attendees:
|
||||||
|
|
||||||
|
body, html_body = prepare_boarding_pass(attendee, template)
|
||||||
|
|
||||||
msg = EmailMultiAlternatives(
|
msg = EmailMultiAlternatives(
|
||||||
bpass.subject,
|
bpass.subject,
|
||||||
bpass.body,
|
bpass.body,
|
||||||
|
@ -233,8 +249,8 @@ def boarding_send(request):
|
||||||
)
|
)
|
||||||
msg.content_subtype="plain"
|
msg.content_subtype="plain"
|
||||||
msg.mixed_subtype="related"
|
msg.mixed_subtype="related"
|
||||||
if bpass.html_body:
|
if html_body:
|
||||||
msg.attach_alternative(bpass.html_body, "text/html")
|
msg.attach_alternative(html_body, "text/html")
|
||||||
|
|
||||||
msg.attach(filename="qrcode.png", content=user.checkin.qrcode, mimetype="image/png")
|
msg.attach(filename="qrcode.png", content=user.checkin.qrcode, mimetype="image/png")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue