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
7557620d
Commit
7557620d
authored
Oct 01, 2015
by
Matt Drayer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9967 from edx/ziafazal/SOL-1247
SOL-1247: use overridden course number and org
parents
635e5491
fcb3a64f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
lms/djangoapps/certificates/tests/test_webview_views.py
+21
-0
lms/djangoapps/certificates/views/webview.py
+5
-4
No files found.
lms/djangoapps/certificates/tests/test_webview_views.py
View file @
7557620d
...
@@ -254,6 +254,27 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
...
@@ -254,6 +254,27 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
self
.
assertIn
(
'refundable course'
,
response
.
content
)
self
.
assertIn
(
'refundable course'
,
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_course_display_overrides
(
self
):
"""
Tests if `Course Number Display String` or `Course Organization Display` is set for a course
in advance settings
Then web certificate should display that course number and course org set in advance
settings instead of original course number and course org.
"""
test_url
=
get_certificate_url
(
user_id
=
self
.
user
.
id
,
course_id
=
unicode
(
self
.
course
.
id
)
)
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
2
)
self
.
course
.
display_coursenumber
=
"overridden_number"
self
.
course
.
display_organization
=
"overridden_org"
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
response
=
self
.
client
.
get
(
test_url
)
self
.
assertIn
(
'overridden_number'
,
response
.
content
)
self
.
assertIn
(
'overridden_org'
,
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_certificate_view_without_org_logo
(
self
):
def
test_certificate_view_without_org_logo
(
self
):
test_url
=
get_certificate_url
(
test_url
=
get_certificate_url
(
user_id
=
self
.
user
.
id
,
user_id
=
self
.
user
.
id
,
...
...
lms/djangoapps/certificates/views/webview.py
View file @
7557620d
...
@@ -90,7 +90,7 @@ def _update_certificate_context(context, course, user, user_certificate):
...
@@ -90,7 +90,7 @@ def _update_certificate_context(context, course, user, user_certificate):
user_fullname
=
user
.
profile
.
name
user_fullname
=
user
.
profile
.
name
platform_name
=
microsite
.
get_value
(
"platform_name"
,
settings
.
PLATFORM_NAME
)
platform_name
=
microsite
.
get_value
(
"platform_name"
,
settings
.
PLATFORM_NAME
)
certificate_type
=
context
.
get
(
'certificate_type'
)
certificate_type
=
context
.
get
(
'certificate_type'
)
partner_short_name
=
course
.
org
partner_short_name
=
course
.
display_organization
if
course
.
display_organization
else
course
.
org
partner_long_name
=
None
partner_long_name
=
None
organizations
=
organization_api
.
get_course_organizations
(
course_id
=
course
.
id
)
organizations
=
organization_api
.
get_course_organizations
(
course_id
=
course
.
id
)
if
organizations
:
if
organizations
:
...
@@ -129,7 +129,8 @@ def _update_certificate_context(context, course, user, user_certificate):
...
@@ -129,7 +129,8 @@ def _update_certificate_context(context, course, user, user_certificate):
)
)
)
)
context
[
'course_number'
]
=
course
.
number
course_number
=
course
.
display_coursenumber
if
course
.
display_coursenumber
else
course
.
number
context
[
'course_number'
]
=
course_number
try
:
try
:
badge
=
BadgeAssertion
.
objects
.
get
(
user
=
user
,
course_id
=
course
.
location
.
course_key
)
badge
=
BadgeAssertion
.
objects
.
get
(
user
=
user
,
course_id
=
course
.
location
.
course_key
)
except
BadgeAssertion
.
DoesNotExist
:
except
BadgeAssertion
.
DoesNotExist
:
...
@@ -239,13 +240,13 @@ def _update_certificate_context(context, course, user, user_certificate):
...
@@ -239,13 +240,13 @@ def _update_certificate_context(context, course, user, user_certificate):
platform_name
=
platform_name
,
platform_name
=
platform_name
,
user_name
=
user_fullname
,
user_name
=
user_fullname
,
partner_short_name
=
partner_short_name
,
partner_short_name
=
partner_short_name
,
course_number
=
course
.
number
course_number
=
course
_
number
)
)
# Translators: This text is bound to the HTML 'title' element of the page and appears in the browser title bar
# Translators: This text is bound to the HTML 'title' element of the page and appears in the browser title bar
context
[
'document_title'
]
=
_
(
"{partner_short_name} {course_number} Certificate | {platform_name}"
)
.
format
(
context
[
'document_title'
]
=
_
(
"{partner_short_name} {course_number} Certificate | {platform_name}"
)
.
format
(
partner_short_name
=
partner_short_name
,
partner_short_name
=
partner_short_name
,
course_number
=
course
.
number
,
course_number
=
course
_
number
,
platform_name
=
platform_name
platform_name
=
platform_name
)
)
...
...
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