Commit 8f90dd83 by Greg Price

Merge pull request #3653 from edx/gprice/discussion-link-command

Add command to get discussion_link for a course
parents f4d97ca5 5e849bfb
from django.core.management.base import BaseCommand, CommandError
from courseware.courses import get_course
class Command(BaseCommand):
args = "<course_id>"
def handle(self, *args, **options):
if not args:
raise CommandError("Course id not specified")
if len(args) > 1:
raise CommandError("Only one course id may be specifiied")
course_id = args[0]
try:
course = get_course(course_id)
except ValueError:
raise CommandError("Invalid course id: {}".format(course_id))
if course.discussion_link:
self.stdout.write(course.discussion_link)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment