Files
edx-platform/lms/djangoapps/discussion/management/commands/sync_user_info.py
M. Zulqarnain 65cf0db337 BOM-2278 : Pylint amnesty in discussion, dashboard (#26275)
* pylint amnesty in discussion, dashboard
2021-02-03 18:15:14 +05:00

23 lines
715 B
Python

"""
One-off script to sync all user information to the
discussion service (later info will be synced automatically)
"""
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.management.base import BaseCommand
import openedx.core.djangoapps.django_comment_common.comment_client as cc
class Command(BaseCommand):
"""
Management command for adding all users to the discussion service.
"""
help = 'Sync all user ids, usernames, and emails to the discussion service.'
def handle(self, *args, **options):
for user in User.objects.all().iterator():
cc_user = cc.User.from_django_user(user)
cc_user.save()