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
d50af576
Commit
d50af576
authored
Aug 04, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make university profile pages also use get_courses_by_university
parent
fb7b48e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
common/lib/xmodule/xmodule/xml_module.py
+1
-0
lms/djangoapps/courseware/courses.py
+6
-1
lms/djangoapps/courseware/views.py
+1
-1
No files found.
common/lib/xmodule/xmodule/xml_module.py
View file @
d50af576
...
...
@@ -41,6 +41,7 @@ class XmlDescriptor(XModuleDescriptor):
# to definition_from_xml, and from the xml returned by definition_to_xml
metadata_attributes
=
(
'format'
,
'graceperiod'
,
'showanswer'
,
'rerandomize'
,
'start'
,
'due'
,
'graded'
,
'display_name'
,
'url_name'
,
'hide_from_toc'
,
'ispublic'
,
# if True, then course is listed for all users; see
# VS[compat] Remove once unused.
'name'
,
'slug'
)
...
...
lms/djangoapps/courseware/courses.py
View file @
d50af576
...
...
@@ -135,6 +135,11 @@ def has_staff_access_to_course(user,course):
return
True
return
False
def
has_access_to_course
(
user
,
course
):
if
course
.
metadata
.
get
(
'ispublic'
):
return
True
return
has_staff_access_to_course
(
user
,
course
)
def
get_courses_by_university
(
user
):
'''
Returns dict of lists of courses available, keyed by course.org (ie university).
...
...
@@ -150,7 +155,7 @@ def get_courses_by_university(user):
universities
=
defaultdict
(
list
)
for
course
in
courses
:
if
settings
.
MITX_FEATURES
.
get
(
'ENABLE_LMS_MIGRATION'
):
if
not
has_
staff_
access_to_course
(
user
,
course
):
if
not
has_access_to_course
(
user
,
course
):
continue
universities
[
course
.
org
]
.
append
(
course
)
return
universities
...
...
lms/djangoapps/courseware/views.py
View file @
d50af576
...
...
@@ -289,7 +289,7 @@ def university_profile(request, org_id):
raise
Http404
(
"University Profile not found for {0}"
.
format
(
org_id
))
# Only grab courses for this org...
courses
=
[
c
for
c
in
all_courses
if
c
.
org
==
org_id
]
courses
=
get_courses_by_university
(
request
.
user
)[
org_id
]
context
=
dict
(
courses
=
courses
,
org_id
=
org_id
)
template_file
=
"university_profile/{0}.html"
.
format
(
org_id
)
.
lower
()
...
...
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