Commit 72ce1af9 by Calen Pennington

Merge pull request #1424 from MITx/feature/ichuang/fix-forum-management-commands

fix forum management commands (assign_default_role was moved)
parents 7f19d489 630607d3
......@@ -6,7 +6,8 @@ Enrollments.
"""
from django.core.management.base import BaseCommand, CommandError
from student.models import CourseEnrollment, assign_default_role
from student.models import CourseEnrollment
from django_comment_client.models import assign_default_role
class Command(BaseCommand):
......
......@@ -6,7 +6,8 @@ Enrollments.
"""
from django.core.management.base import BaseCommand, CommandError
from student.models import CourseEnrollment, assign_default_role
from student.models import CourseEnrollment
from django_comment_client.models import assign_default_role
class Command(BaseCommand):
......
"""
Reload forum (comment client) users from existing users.
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import comment_client as cc
class Command(BaseCommand):
help = 'Reload forum (comment client) users from existing users'
def adduser(self,user):
print user
try:
cc_user = cc.User.from_django_user(user)
cc_user.save()
except Exception as err:
print "update user info to discussion failed for user with id: %s" % user
def handle(self, *args, **options):
if len(args) != 0:
uset = [User.objects.get(username=x) for x in args]
else:
uset = User.objects.all()
for user in uset:
self.adduser(user)
\ No newline at end of file
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