-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from CTPUG/feature/add_cmd_to_list_video_revi…
…ewers Add command to generate a csv of talk titles and video reviewers
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |