Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
12c3c4cc
Commit
12c3c4cc
authored
Mar 11, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract complete user info into a json file
parent
909aec43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
student/management/commands/userinfo.py
+38
-0
No files found.
student/management/commands/userinfo.py
0 → 100644
View file @
12c3c4cc
import
os.path
from
lxml
import
etree
from
django.core.management.base
import
BaseCommand
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
import
mitxmako.middleware
as
middleware
import
json
from
student.models
import
UserProfile
middleware
.
MakoMiddleware
()
class
Command
(
BaseCommand
):
help
=
\
''' Extract full user information into a JSON file.
Pass a single filename.'''
def
handle
(
self
,
*
args
,
**
options
):
f
=
open
(
args
[
0
],
'w'
)
#text = open(args[0]).read()
#subject = open(args[1]).read()
users
=
User
.
objects
.
all
()
l
=
[]
for
user
in
users
:
up
=
UserProfile
.
objects
.
get
(
user
=
user
)
d
=
{
'username'
:
user
.
username
,
'email'
:
user
.
email
,
'is_active'
:
user
.
is_active
,
'joined'
:
user
.
date_joined
.
isoformat
(),
'name'
:
up
.
name
,
'language'
:
up
.
language
,
'location'
:
up
.
location
}
l
.
append
(
d
)
json
.
dump
(
l
,
f
)
f
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment