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
0049c97d
Commit
0049c97d
authored
Jan 11, 2015
by
jsa
Committed by
Andy Armstrong
Jan 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use bulk_ops on course_about
parent
9607aa23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
73 deletions
+71
-73
lms/djangoapps/courseware/views.py
+71
-73
No files found.
lms/djangoapps/courseware/views.py
View file @
0049c97d
...
@@ -737,83 +737,81 @@ def course_about(request, course_id):
...
@@ -737,83 +737,81 @@ def course_about(request, course_id):
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
permission_name
=
microsite
.
get_value
(
with
modulestore
()
.
bulk_operations
(
course_key
):
'COURSE_ABOUT_VISIBILITY_PERMISSION'
,
permission_name
=
microsite
.
get_value
(
settings
.
COURSE_ABOUT_VISIBILITY_PERMISSION
'COURSE_ABOUT_VISIBILITY_PERMISSION'
,
)
settings
.
COURSE_ABOUT_VISIBILITY_PERMISSION
course
=
get_course_with_access
(
request
.
user
,
permission_name
,
course_key
)
)
course
=
get_course_with_access
(
request
.
user
,
permission_name
,
course_key
)
if
microsite
.
get_value
(
'ENABLE_MKTG_SITE'
,
settings
.
FEATURES
.
get
(
'ENABLE_MKTG_SITE'
,
False
)
):
return
redirect
(
reverse
(
'info'
,
args
=
[
course
.
id
.
to_deprecated_string
()]))
registered
=
registered_for_course
(
course
,
request
.
user
)
staff_access
=
has_access
(
request
.
user
,
'staff'
,
course
)
if
microsite
.
get_value
(
'ENABLE_MKTG_SITE'
,
settings
.
FEATURES
.
get
(
'ENABLE_MKTG_SITE'
,
False
)):
studio_url
=
get_studio_url
(
course
,
'settings/details'
)
return
redirect
(
reverse
(
'info'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
)
if
has_access
(
request
.
user
,
'load'
,
course
):
registered
=
registered_for_course
(
course
,
request
.
user
)
course_target
=
reverse
(
'info'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
else
:
course_target
=
reverse
(
'about_course'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
show_courseware_link
=
(
has_access
(
request
.
user
,
'load'
,
course
)
or
staff_access
=
has_access
(
request
.
user
,
'staff'
,
course
)
settings
.
FEATURES
.
get
(
'ENABLE_LMS_MIGRATION'
)
)
studio_url
=
get_studio_url
(
course
,
'settings/details'
)
# Note: this is a flow for payment for course registration, not the Verified Certificate flow.
if
has_access
(
request
.
user
,
'load'
,
course
):
registration_price
=
0
course_target
=
reverse
(
'info'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
in_cart
=
False
else
:
reg_then_add_to_cart_link
=
""
course_target
=
reverse
(
'about_course'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
_is_shopping_cart_enabled
=
is_shopping_cart_enabled
()
show_courseware_link
=
(
has_access
(
request
.
user
,
'load'
,
course
)
or
if
(
_is_shopping_cart_enabled
):
settings
.
FEATURES
.
get
(
'ENABLE_LMS_MIGRATION'
))
registration_price
=
CourseMode
.
min_course_price_for_currency
(
course_key
,
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
0
])
# Note: this is a flow for payment for course registration, not the Verified Certificate flow.
if
request
.
user
.
is_authenticated
():
registration_price
=
0
cart
=
shoppingcart
.
models
.
Order
.
get_cart_for_user
(
request
.
user
)
in_cart
=
False
in_cart
=
shoppingcart
.
models
.
PaidCourseRegistration
.
contained_in_order
(
cart
,
course_key
)
or
\
reg_then_add_to_cart_link
=
""
shoppingcart
.
models
.
CourseRegCodeItem
.
contained_in_order
(
cart
,
course_key
)
_is_shopping_cart_enabled
=
is_shopping_cart_enabled
()
reg_then_add_to_cart_link
=
"{reg_url}?course_id={course_id}&enrollment_action=add_to_cart"
.
format
(
if
_is_shopping_cart_enabled
:
reg_url
=
reverse
(
'register_user'
),
course_id
=
course
.
id
.
to_deprecated_string
())
registration_price
=
CourseMode
.
min_course_price_for_currency
(
course_key
,
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
0
])
# Used to provide context to message to student if enrollment not allowed
if
request
.
user
.
is_authenticated
():
can_enroll
=
has_access
(
request
.
user
,
'enroll'
,
course
)
cart
=
shoppingcart
.
models
.
Order
.
get_cart_for_user
(
request
.
user
)
invitation_only
=
course
.
invitation_only
in_cart
=
shoppingcart
.
models
.
PaidCourseRegistration
.
contained_in_order
(
cart
,
course_key
)
or
\
is_course_full
=
CourseEnrollment
.
is_course_full
(
course
)
shoppingcart
.
models
.
CourseRegCodeItem
.
contained_in_order
(
cart
,
course_key
)
# Register button should be disabled if one of the following is true:
reg_then_add_to_cart_link
=
"{reg_url}?course_id={course_id}&enrollment_action=add_to_cart"
.
format
(
# - Student is already registered for course
reg_url
=
reverse
(
'register_user'
),
course_id
=
course
.
id
.
to_deprecated_string
())
# - Course is already full
# - Student cannot enroll in course
# Used to provide context to message to student if enrollment not allowed
active_reg_button
=
not
(
registered
or
is_course_full
or
not
can_enroll
)
can_enroll
=
has_access
(
request
.
user
,
'enroll'
,
course
)
invitation_only
=
course
.
invitation_only
is_shib_course
=
uses_shib
(
course
)
is_course_full
=
CourseEnrollment
.
is_course_full
(
course
)
return
render_to_response
(
'courseware/course_about.html'
,
{
# Register button should be disabled if one of the following is true:
'course'
:
course
,
# - Student is already registered for course
'staff_access'
:
staff_access
,
# - Course is already full
'studio_url'
:
studio_url
,
# - Student cannot enroll in course
'registered'
:
registered
,
active_reg_button
=
not
(
registered
or
is_course_full
or
not
can_enroll
)
'course_target'
:
course_target
,
'registration_price'
:
registration_price
,
is_shib_course
=
uses_shib
(
course
)
'currency_symbol'
:
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
1
],
'in_cart'
:
in_cart
,
return
render_to_response
(
'courseware/course_about.html'
,
{
'reg_then_add_to_cart_link'
:
reg_then_add_to_cart_link
,
'course'
:
course
,
'show_courseware_link'
:
show_courseware_link
,
'staff_access'
:
staff_access
,
'is_course_full'
:
is_course_full
,
'studio_url'
:
studio_url
,
'can_enroll'
:
can_enroll
,
'registered'
:
registered
,
'invitation_only'
:
invitation_only
,
'course_target'
:
course_target
,
'active_reg_button'
:
active_reg_button
,
'registration_price'
:
registration_price
,
'is_shib_course'
:
is_shib_course
,
'currency_symbol'
:
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
1
],
# We do not want to display the internal courseware header, which is used when the course is found in the
'in_cart'
:
in_cart
,
# context. This value is therefor explicitly set to render the appropriate header.
'reg_then_add_to_cart_link'
:
reg_then_add_to_cart_link
,
'disable_courseware_header'
:
True
,
'show_courseware_link'
:
show_courseware_link
,
'is_shopping_cart_enabled'
:
_is_shopping_cart_enabled
,
'is_course_full'
:
is_course_full
,
'cart_link'
:
reverse
(
'shoppingcart.views.show_cart'
),
'can_enroll'
:
can_enroll
,
})
'invitation_only'
:
invitation_only
,
'active_reg_button'
:
active_reg_button
,
'is_shib_course'
:
is_shib_course
,
# We do not want to display the internal courseware header, which is used when the course is found in the
# context. This value is therefor explicitly set to render the appropriate header.
'disable_courseware_header'
:
True
,
'is_shopping_cart_enabled'
:
_is_shopping_cart_enabled
,
'cart_link'
:
reverse
(
'shoppingcart.views.show_cart'
),
})
@ensure_csrf_cookie
@ensure_csrf_cookie
...
...
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