switch to using a filefield to save the invoice pdf

This commit is contained in:
Thomas Steen Rasmussen 2016-05-30 19:49:32 +02:00
parent 475f996a02
commit 2fdfacc4d7
2 changed files with 3 additions and 3 deletions

View file

@ -43,8 +43,8 @@ class Command(BaseCommand):
self.stdout.write('ERROR: Unable to generate PDF file for invoice #%s' % invoice.pk)
continue
# update invoice object
invoice.pdf_generated=True
# update invoice object with the file
invoice.pdf.save(invoice.filename, File(pdffile))
invoice.save()
### check if we need to send out any invoices

View file

@ -255,7 +255,7 @@ class EpayPayment(CreatedUpdatedModel, UUIDModel):
class Invoice(CreatedUpdatedModel):
order = models.OneToOneField('shop.Order')
pdf_generated = models.BooleanField(default=False)
pdf = models.FileField(null=True, blank=True)
sent_to_customer = models.BooleanField(default=False)
def __str__(self):