Fix some stuff for new tickets. Also fix bootstrap-dev script.
This commit is contained in:
parent
7dc82ee4ee
commit
f1ce253d4a
|
@ -40,6 +40,7 @@
|
|||
<td>
|
||||
{{ ticket.product.name }}
|
||||
<td>
|
||||
{% if ticket.ticket_type.single_ticket_per_product %}{{ ticket.get_orp.quantity }} × {% endif %}
|
||||
{{ ticket.product.price|currency }}
|
||||
<td>
|
||||
{% if ticket.used %}
|
||||
|
|
|
@ -5,6 +5,8 @@ import qrcode
|
|||
from django.conf import settings
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from shop.models import OrderProductRelation
|
||||
from utils.models import UUIDModel, CampRelatedModel
|
||||
from utils.pdf import generate_pdf_letter
|
||||
from django.db import models
|
||||
|
@ -88,9 +90,15 @@ class BaseTicket(CampRelatedModel, UUIDModel):
|
|||
)
|
||||
|
||||
def generate_pdf(self):
|
||||
formatdict = {"ticket": self}
|
||||
|
||||
if self.ticket_type.single_ticket_per_product and self.shortname == "shop":
|
||||
orp = self.get_orp()
|
||||
formatdict["quantity"] = orp.quantity
|
||||
|
||||
return generate_pdf_letter(
|
||||
filename="{}_ticket_{}.pdf".format(self.shortname, self.pk),
|
||||
formatdict={"ticket": self},
|
||||
formatdict=formatdict,
|
||||
template="pdf/ticket.html",
|
||||
)
|
||||
|
||||
|
@ -156,3 +164,6 @@ class ShopTicket(BaseTicket):
|
|||
@property
|
||||
def shortname(self):
|
||||
return "shop"
|
||||
|
||||
def get_orp(self):
|
||||
return OrderProductRelation.objects.get(product=self.product, order=self.order)
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
<br>
|
||||
<h2>{{ ticket.ticket_type.camp.title }} Ticket</h2>
|
||||
<h3>Type: {{ ticket.ticket_type.name }}</h3>
|
||||
<h3>Product: {{ ticket.product.name }}</h3>
|
||||
{% if quantity %}
|
||||
<h3>Quantity: {{ quantity }}</h3>
|
||||
{% endif %}
|
||||
|
||||
{% if ticket.name %}
|
||||
<h3>Participant: {{ ticket.name }}</h3>
|
||||
|
|
|
@ -1399,7 +1399,8 @@ class Command(BaseCommand):
|
|||
camp=camp,
|
||||
user=users[1],
|
||||
seats=2,
|
||||
location="From Copenhagen",
|
||||
from_location="Copenhagen",
|
||||
to_location="BornHack",
|
||||
when=timezone.datetime(year, 8, 27, 12, 0, tzinfo=timezone.utc),
|
||||
description="I have space for two people and a little bit of luggage",
|
||||
)
|
||||
|
@ -1407,7 +1408,8 @@ class Command(BaseCommand):
|
|||
camp=camp,
|
||||
user=users[1],
|
||||
seats=2,
|
||||
location="To Copenhagen",
|
||||
from_location="BornHack",
|
||||
to_location="Copenhagen",
|
||||
when=timezone.datetime(year, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||
description="I have space for two people and a little bit of luggage",
|
||||
)
|
||||
|
@ -1415,7 +1417,8 @@ class Command(BaseCommand):
|
|||
camp=camp,
|
||||
user=users[4],
|
||||
seats=1,
|
||||
location="From Aarhus",
|
||||
from_location="Aarhus",
|
||||
to_location="BornHack",
|
||||
when=timezone.datetime(year, 8, 27, 12, 0, tzinfo=timezone.utc),
|
||||
description="I need a ride and have a large backpack",
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue