include ticket type in filename
This commit is contained in:
parent
3dcb43e575
commit
c6ee407751
|
@ -57,7 +57,7 @@ class BaseTicket(CreatedUpdatedModel, UUIDModel):
|
||||||
|
|
||||||
def generate_pdf(self):
|
def generate_pdf(self):
|
||||||
return generate_pdf_letter(
|
return generate_pdf_letter(
|
||||||
filename='ticket_{}.pdf'.format(self.pk),
|
filename='{}_ticket_{}.pdf'.format(self.shortname, self.pk),
|
||||||
formatdict={'ticket': self},
|
formatdict={'ticket': self},
|
||||||
template='pdf/ticket.html'
|
template='pdf/ticket.html'
|
||||||
)
|
)
|
||||||
|
@ -69,6 +69,10 @@ class SponsorTicket(BaseTicket):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'SponsorTicket: {}'.format(self.pk)
|
return 'SponsorTicket: {}'.format(self.pk)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def shortname(self):
|
||||||
|
return "sponsor"
|
||||||
|
|
||||||
|
|
||||||
class DiscountTicket(BaseTicket):
|
class DiscountTicket(BaseTicket):
|
||||||
price = models.IntegerField(
|
price = models.IntegerField(
|
||||||
|
@ -78,6 +82,9 @@ class DiscountTicket(BaseTicket):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'DiscountTicket: {}'.format(self.pk)
|
return 'DiscountTicket: {}'.format(self.pk)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def shortname(self):
|
||||||
|
return "discount"
|
||||||
|
|
||||||
class ShopTicket(BaseTicket):
|
class ShopTicket(BaseTicket):
|
||||||
order = models.ForeignKey('shop.Order', related_name='shoptickets')
|
order = models.ForeignKey('shop.Order', related_name='shoptickets')
|
||||||
|
@ -118,3 +125,8 @@ class ShopTicket(BaseTicket):
|
||||||
return str(
|
return str(
|
||||||
reverse_lazy('tickets:shopticket_edit', kwargs={'pk': self.pk})
|
reverse_lazy('tickets:shopticket_edit', kwargs={'pk': self.pk})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def shortname(self):
|
||||||
|
return "shop"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue