Check if tickets are generated. Also show if tickets are generated in the admin.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-08-08 09:55:06 +02:00
parent ac19a6db4b
commit 74a9e9df71
2 changed files with 8 additions and 2 deletions

View file

@ -5,7 +5,7 @@ from .models import Sponsor, SponsorTier
@admin.register(Sponsor)
class SponsorAdmin(admin.ModelAdmin):
list_display = ("name", "tier", "ticket_email", "ticket_ready", "tickets_sent")
list_display = ("name", "tier", "ticket_email", "ticket_ready", "tickets_sent", "tickets_generated")
list_filter = ("tier__camp",)

View file

@ -24,7 +24,13 @@ class Command(BaseCommand):
sponsors = Sponsor.objects.filter(tier__camp=camp, tickets_generated=False)
for sponsor in sponsors:
if sponsor.tier.tickets and sponsor.ticket_email and sponsor.ticket_ready and not sponsor.tickets_sent:
if (
sponsor.tier.tickets and
sponsor.tickets_generated and
sponsor.ticket_email and
sponsor.ticket_ready and
not sponsor.tickets_sent
):
self.output("# Generating outgoing email to send tickets for {}:".format(sponsor))
# send the email
if add_sponsorticket_email(sponsor=sponsor):