Skip to content

Commit

Permalink
Merge pull request #560 from CTPUG/feature/add_cmd_to_list_video_revi…
Browse files Browse the repository at this point in the history
…ewers

Add command to generate a csv of talk titles and video reviewers
  • Loading branch information
drnlm committed Nov 11, 2020
2 parents f771698 + 0c1caf4 commit e0dd4bf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions wafer/management/commands/wafer_talk_video_reviewers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import sys
import csv

from django.core.management.base import BaseCommand

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


class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted talks are listed")

def _video_reviewers(self, options):
talks = Talk.objects.filter(status=ACCEPTED)

csv_file = csv.writer(sys.stdout)
for talk in talks:
reviewer = talk.video_reviewer
if not reviewer:
reviewer = 'NO REVIEWER'
row = [talk.title,
talk.get_authors_display_name(),
reviewer,
]
csv_file.writerow(row)

def handle(self, *args, **options):
self._video_reviewers(options)

0 comments on commit e0dd4bf

Please sign in to comment.