Skip to content

Commit

Permalink
Merge pull request #366 from CTPUG/feature/speaker_tickets_provisional
Browse files Browse the repository at this point in the history
With the addition of provisional status, it makes more sense to defau…
  • Loading branch information
drnlm committed Aug 4, 2017
2 parents 4eb2115 + df6dfe3 commit d264c9a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions wafer/management/commands/wafer_speaker_tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
from django.core.management.base import BaseCommand

from django.contrib.auth import get_user_model
from wafer.talks.models import ACCEPTED
from wafer.talks.models import ACCEPTED, PROVISIONAL


class Command(BaseCommand):
help = ("List speakers and associated tickets. By default, only lists"
" speakers for accepted talk, but this can be overriden by"
" the --all option")
" speakers for provisionally accepted talks, but this can be"
" overriden by the --all or --accepted options")

def add_arguments(self, parser):
parser.add_argument('--all', action="store_true",
help='List speakers and tickets (for all talks)')
parser.add_argument('--accepted', action="store_true",
help='List speakers and tickets (for'
' fully accepted talks)')

def _speaker_tickets(self, options):
people = get_user_model().objects.filter(
Expand All @@ -26,9 +29,12 @@ def _speaker_tickets(self, options):
# accounts
if options['all']:
titles = [x.title for x in person.talks.all()]
else:
elif options['accepted']:
titles = [x.title for x in
person.talks.filter(status=ACCEPTED)]
else:
titles = [x.title for x in
person.talks.filter(status=PROVISIONAL)]
if not titles:
continue
tickets = person.ticket.all()
Expand Down

0 comments on commit d264c9a

Please sign in to comment.