Skip to content

Commit

Permalink
Merge pull request mitocw#307 from mitocw/develop
Browse files Browse the repository at this point in the history
Update Report Format
  • Loading branch information
Ali-Salman29 authored Feb 3, 2022
2 parents 4c99a6f + d8d16ed commit 58ea5a4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lms/djangoapps/dashboard/sysadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,17 @@ def post(self, request):
track.views.server_track(request, action, {}, page='user_sysdashboard')

if action == 'download_users':
header = [_('username'), _('email'), ]
data = ([u.username, u.email] for u in
(User.objects.all().iterator()))
header = [_('username'), _('email'), _('name'), _('country') ]
data = []
for u in (User.objects.select_related('profile').iterator()):
try:
data.append([u.username, u.email, u.profile.name, u.profile.country])
except UserProfile.DoesNotExist as err:
data.append([u.username, u.email, '', ''])
msg = _(u'Cannot find user profile with username {username} - {error}').format(
username=u.username,
error=str(err))
log.warning(msg)
return self.return_csv('users_{0}.csv'.format(
request.META['SERVER_NAME']), header, data)
elif action == 'create_user':
Expand Down

0 comments on commit 58ea5a4

Please sign in to comment.