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
a995ef0f
Commit
a995ef0f
authored
Mar 10, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instructors can see grades -- syncing machines -- nonworking code
--HG-- branch : visible-grades
parent
c8f261ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
courseware/views.py
+14
-7
urls.py
+1
-0
No files found.
courseware/views.py
View file @
a995ef0f
...
...
@@ -67,17 +67,24 @@ def get_grade(request, problem, cache):
return
(
correct
,
total
)
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
profile
(
request
):
def
profile
(
request
,
student_id
=
None
):
''' User profile. Show username, location, etc, as well as grades .
We need to allow the user to change some of these settings .'''
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/'
)
dom
=
content_parser
.
course_file
(
request
.
user
)
if
student_id
==
None
:
student
=
request
.
user
else
:
if
'course_admin'
not
in
user_groups
(
request
.
user
):
raise
Http404
student
=
User
.
objects
.
get
(
id
=
int
(
student_id
))
dom
=
content_parser
.
course_file
(
student
)
course
=
dom
.
xpath
(
'//course/@name'
)[
0
]
xmlChapters
=
dom
.
xpath
(
'//course[@name=$course]/chapter'
,
course
=
course
)
responses
=
StudentModule
.
objects
.
filter
(
student
=
request
.
user
)
responses
=
StudentModule
.
objects
.
filter
(
student
=
student
)
response_by_id
=
{}
for
response
in
responses
:
response_by_id
[
response
.
module_id
]
=
response
...
...
@@ -252,12 +259,12 @@ def profile(request):
]
user_info
=
UserProfile
.
objects
.
get
(
user
=
request
.
user
)
# request.user.profile_cache #
user_info
=
UserProfile
.
objects
.
get
(
user
=
student
)
# request.user.profile_cache #
context
=
{
'name'
:
user_info
.
name
,
'username'
:
request
.
user
.
username
,
'username'
:
student
.
username
,
'location'
:
user_info
.
location
,
'language'
:
user_info
.
language
,
'email'
:
request
.
user
.
email
,
'email'
:
student
.
email
,
'chapters'
:
chapters
,
'format_url_params'
:
format_url_params
,
'grade_summary'
:
grade_summary
,
...
...
urls.py
View file @
a995ef0f
...
...
@@ -43,6 +43,7 @@ if settings.COURSEWARE_ENABLED:
url
(
r'^section/(?P<section>[^/]*)/$'
,
'courseware.views.render_section'
),
url
(
r'^modx/(?P<module>[^/]*)/(?P<id>[^/]*)/(?P<dispatch>[^/]*)$'
,
'courseware.views.modx_dispatch'
),
#reset_problem'),
url
(
r'^profile$'
,
'courseware.views.profile'
),
url
(
r'^profile/(?P<student_id>[^/]*)/$'
,
'courseware.views.profile'
),
url
(
r'^change_setting$'
,
'student.views.change_setting'
),
url
(
r'^s/(?P<template>[^/]*)$'
,
'static_template_view.views.auth_index'
),
url
(
r'^book/(?P<page>[^/]*)$'
,
'staticbook.views.index'
),
...
...
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