Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
c8b4f7e7
Commit
c8b4f7e7
authored
6 years ago
by
Michael Roytman
Browse files
Options
Downloads
Patches
Plain Diff
allow configurability of the minimum price for a course mode
parent
89c36ad6
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/djangoapps/course_modes/models.py
+12
-2
12 additions, 2 deletions
common/djangoapps/course_modes/models.py
common/djangoapps/course_modes/tests/test_models.py
+1
-0
1 addition, 0 deletions
common/djangoapps/course_modes/tests/test_models.py
lms/envs/common.py
+11
-7
11 additions, 7 deletions
lms/envs/common.py
with
24 additions
and
9 deletions
common/djangoapps/course_modes/models.py
+
12
−
2
View file @
c8b4f7e7
...
...
@@ -202,8 +202,18 @@ class CourseMode(models.Model):
raise
ValidationError
(
_
(
u
"
Professional education modes are not allowed to have expiration_datetime set.
"
)
)
if
self
.
is_verified_slug
(
self
.
mode_slug
)
and
self
.
min_price
<=
0
:
raise
ValidationError
(
_
(
u
"
Verified modes cannot be free.
"
))
mode_config
=
settings
.
COURSE_ENROLLMENT_MODES
.
get
(
self
.
mode_slug
,
{})
min_price_for_mode
=
mode_config
.
get
(
'
min_price
'
,
0
)
if
self
.
min_price
<
min_price_for_mode
:
mode_display_name
=
mode_config
.
get
(
'
display_name
'
,
self
.
mode_slug
)
raise
ValidationError
(
_
(
u
"
The {course_mode} course mode has a minimum price of {min_price}. You must set a price greater than or equal to {min_price}.
"
.
format
(
course_mode
=
mode_display_name
,
min_price
=
min_price_for_mode
)
)
)
def
save
(
self
,
force_insert
=
False
,
force_update
=
False
,
using
=
None
):
# Ensure currency is always lowercase.
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/course_modes/tests/test_models.py
+
1
−
0
View file @
c8b4f7e7
...
...
@@ -474,6 +474,7 @@ class CourseModeModelTest(TestCase):
(
CourseMode
.
CREDIT_MODE
,
False
),
(
CourseMode
.
PROFESSIONAL
,
True
),
(
CourseMode
.
NO_ID_PROFESSIONAL_MODE
,
False
),
(
CourseMode
.
MASTERS
,
False
),
)
@ddt.unpack
def
test_verified_min_price
(
self
,
mode_slug
,
is_error_expected
):
...
...
This diff is collapsed.
Click to expand it.
lms/envs/common.py
+
11
−
7
View file @
c8b4f7e7
...
...
@@ -3347,48 +3347,52 @@ ENTERPRISE_CUSTOMER_COOKIE_NAME = 'enterprise_customer_uuid'
BASE_COOKIE_DOMAIN
=
'
localhost
'
############## Settings for Course Enrollment Modes ######################
# The min_price key refers to the minimum price allowed for an instance
# of a particular type of course enrollment mode. This is not to be confused
# with the min_price field of the CourseMode model, which refers to the actual
# price of the CourseMode.
COURSE_ENROLLMENT_MODES
=
{
"
audit
"
:
{
"
id
"
:
1
,
"
slug
"
:
"
audit
"
,
"
display_name
"
:
_
(
"
Audit
"
),
"
min_price
"
:
0
"
min_price
"
:
0
,
},
"
verified
"
:
{
"
id
"
:
2
,
"
slug
"
:
"
verified
"
,
"
display_name
"
:
_
(
"
Verified
"
),
"
min_price
"
:
0
"
min_price
"
:
1
,
},
"
professional
"
:
{
"
id
"
:
3
,
"
slug
"
:
"
professional
"
,
"
display_name
"
:
_
(
"
Professional
"
),
"
min_price
"
:
0
"
min_price
"
:
1
,
},
"
no-id-professional
"
:
{
"
id
"
:
4
,
"
slug
"
:
"
no-id-professional
"
,
"
display_name
"
:
_
(
"
No-Id-Professional
"
),
"
min_price
"
:
0
"
min_price
"
:
0
,
},
"
credit
"
:
{
"
id
"
:
5
,
"
slug
"
:
"
credit
"
,
"
display_name
"
:
_
(
"
Credit
"
),
"
min_price
"
:
0
"
min_price
"
:
0
,
},
"
honor
"
:
{
"
id
"
:
6
,
"
slug
"
:
"
honor
"
,
"
display_name
"
:
_
(
"
Honor
"
),
"
min_price
"
:
0
"
min_price
"
:
0
,
},
"
masters
"
:
{
"
id
"
:
7
,
"
slug
"
:
"
masters
"
,
"
display_name
"
:
_
(
"
Master
'
s
"
),
"
min_price
"
:
0
"
min_price
"
:
0
,
},
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment