feat: paid unpaid named course modes
Add executive education variants for paid and unpaid modes. PROD-2708
This commit is contained in:
@@ -136,6 +136,8 @@ class CourseMode(models.Model):
|
|||||||
CREDIT_MODE = 'credit'
|
CREDIT_MODE = 'credit'
|
||||||
MASTERS = 'masters'
|
MASTERS = 'masters'
|
||||||
EXECUTIVE_EDUCATION = 'executive-education'
|
EXECUTIVE_EDUCATION = 'executive-education'
|
||||||
|
PAID_EXECUTIVE_EDUCATION = 'paid-executive-education'
|
||||||
|
UNPAID_EXECUTIVE_EDUCATION = 'unpaid-executive-education'
|
||||||
|
|
||||||
DEFAULT_MODE = Mode(
|
DEFAULT_MODE = Mode(
|
||||||
settings.COURSE_MODE_DEFAULTS['slug'],
|
settings.COURSE_MODE_DEFAULTS['slug'],
|
||||||
@@ -158,14 +160,18 @@ class CourseMode(models.Model):
|
|||||||
PROFESSIONAL,
|
PROFESSIONAL,
|
||||||
VERIFIED,
|
VERIFIED,
|
||||||
MASTERS,
|
MASTERS,
|
||||||
EXECUTIVE_EDUCATION
|
EXECUTIVE_EDUCATION,
|
||||||
|
PAID_EXECUTIVE_EDUCATION,
|
||||||
|
UNPAID_EXECUTIVE_EDUCATION
|
||||||
]
|
]
|
||||||
|
|
||||||
# Modes utilized for audit/free enrollments
|
# Modes utilized for audit/free enrollments
|
||||||
AUDIT_MODES = [AUDIT, HONOR]
|
AUDIT_MODES = [AUDIT, HONOR, UNPAID_EXECUTIVE_EDUCATION]
|
||||||
|
|
||||||
# Modes that allow a student to pursue a verified certificate
|
# Modes that allow a student to pursue a verified certificate
|
||||||
VERIFIED_MODES = [VERIFIED, PROFESSIONAL, MASTERS, EXECUTIVE_EDUCATION]
|
VERIFIED_MODES = [
|
||||||
|
VERIFIED, PROFESSIONAL, MASTERS, EXECUTIVE_EDUCATION, PAID_EXECUTIVE_EDUCATION
|
||||||
|
]
|
||||||
|
|
||||||
# Modes that allow a student to pursue a non-verified certificate
|
# Modes that allow a student to pursue a non-verified certificate
|
||||||
NON_VERIFIED_MODES = [HONOR, AUDIT, NO_ID_PROFESSIONAL_MODE]
|
NON_VERIFIED_MODES = [HONOR, AUDIT, NO_ID_PROFESSIONAL_MODE]
|
||||||
@@ -174,7 +180,9 @@ class CourseMode(models.Model):
|
|||||||
CREDIT_MODES = [CREDIT_MODE]
|
CREDIT_MODES = [CREDIT_MODE]
|
||||||
|
|
||||||
# Modes that are eligible to purchase credit
|
# Modes that are eligible to purchase credit
|
||||||
CREDIT_ELIGIBLE_MODES = [VERIFIED, PROFESSIONAL, NO_ID_PROFESSIONAL_MODE, EXECUTIVE_EDUCATION]
|
CREDIT_ELIGIBLE_MODES = [
|
||||||
|
VERIFIED, PROFESSIONAL, NO_ID_PROFESSIONAL_MODE, EXECUTIVE_EDUCATION, PAID_EXECUTIVE_EDUCATION
|
||||||
|
]
|
||||||
|
|
||||||
# Modes for which certificates/programs may need to be updated
|
# Modes for which certificates/programs may need to be updated
|
||||||
CERTIFICATE_RELEVANT_MODES = CREDIT_MODES + CREDIT_ELIGIBLE_MODES + [MASTERS]
|
CERTIFICATE_RELEVANT_MODES = CREDIT_MODES + CREDIT_ELIGIBLE_MODES + [MASTERS]
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Generated by Django 3.2.12 on 2022-03-07 11:00
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('certificates', '0032_change_certificatedateoverride_date'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='certificatetemplate',
|
||||||
|
name='mode',
|
||||||
|
field=models.CharField(blank=True, choices=[('verified', 'verified'), ('honor', 'honor'), ('audit', 'audit'), ('professional', 'professional'), ('no-id-professional', 'no-id-professional'), ('masters', 'masters'), ('executive-education', 'executive-education'), ('paid-executive-education', 'paid-executive-education')], default='honor', help_text='The course mode for this template.', max_length=125, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='generatedcertificate',
|
||||||
|
name='mode',
|
||||||
|
field=models.CharField(choices=[('verified', 'verified'), ('honor', 'honor'), ('audit', 'audit'), ('professional', 'professional'), ('no-id-professional', 'no-id-professional'), ('masters', 'masters'), ('executive-education', 'executive-education'), ('paid-executive-education', 'paid-executive-education')], default='honor', max_length=32),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='historicalgeneratedcertificate',
|
||||||
|
name='mode',
|
||||||
|
field=models.CharField(choices=[('verified', 'verified'), ('honor', 'honor'), ('audit', 'audit'), ('professional', 'professional'), ('no-id-professional', 'no-id-professional'), ('masters', 'masters'), ('executive-education', 'executive-education'), ('paid-executive-education', 'paid-executive-education')], default='honor', max_length=32),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -211,10 +211,14 @@ class GeneratedCertificate(models.Model):
|
|||||||
'professional',
|
'professional',
|
||||||
'no-id-professional',
|
'no-id-professional',
|
||||||
'masters',
|
'masters',
|
||||||
'executive-education'
|
'executive-education',
|
||||||
|
'paid-executive-education',
|
||||||
)
|
)
|
||||||
|
|
||||||
VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION] # pylint: disable=line-too-long
|
VERIFIED_CERTS_MODES = [
|
||||||
|
CourseMode.VERIFIED, CourseMode.CREDIT_MODE, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION,
|
||||||
|
CourseMode.PAID_EXECUTIVE_EDUCATION
|
||||||
|
]
|
||||||
|
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
course_id = CourseKeyField(max_length=255, blank=True, default=None)
|
course_id = CourseKeyField(max_length=255, blank=True, default=None)
|
||||||
|
|||||||
@@ -216,7 +216,9 @@ def get_enrollments_for_courses_in_program(user, program):
|
|||||||
return CourseEnrollment.objects.filter(
|
return CourseEnrollment.objects.filter(
|
||||||
user=user,
|
user=user,
|
||||||
course_id__in=course_keys,
|
course_id__in=course_keys,
|
||||||
mode__in=[CourseMode.VERIFIED, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION],
|
mode__in=[
|
||||||
|
CourseMode.VERIFIED, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION, CourseMode.PAID_EXECUTIVE_EDUCATION
|
||||||
|
],
|
||||||
is_active=True,
|
is_active=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4579,7 +4579,19 @@ COURSE_ENROLLMENT_MODES = {
|
|||||||
"slug": "executive-educations",
|
"slug": "executive-educations",
|
||||||
"display_name": _("Executive Education"),
|
"display_name": _("Executive Education"),
|
||||||
"min_price": 1
|
"min_price": 1
|
||||||
}
|
},
|
||||||
|
"unpaid-executive-education": {
|
||||||
|
"id": 9,
|
||||||
|
"slug": "unpaid-executive-education",
|
||||||
|
"display_name": _("Unpaid Executive Education"),
|
||||||
|
"min_price": 0
|
||||||
|
},
|
||||||
|
"paid-executive-education": {
|
||||||
|
"id": 10,
|
||||||
|
"slug": "paid-executive-education",
|
||||||
|
"display_name": _("Paid Executive Education"),
|
||||||
|
"min_price": 1
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
CONTENT_TYPE_GATE_GROUP_IDS = {
|
CONTENT_TYPE_GATE_GROUP_IDS = {
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ from openedx.core.djangolib.markup import HTML, Text
|
|||||||
<th scope="row">${_("Executive Education")}</th><td>${modes['executive-education']}</td>
|
<th scope="row">${_("Executive Education")}</th><td>${modes['executive-education']}</td>
|
||||||
</tr>
|
</tr>
|
||||||
%endif
|
%endif
|
||||||
|
%if modes["unpaid-executive-education"] > 0:
|
||||||
|
<tr>
|
||||||
|
<th scope="row">${_("Unpaid Executive Education")}</th><td>${modes['unpaid-executive-education']}</td>
|
||||||
|
</tr>
|
||||||
|
%endif
|
||||||
|
%if modes["paid-executive-education"] > 0:
|
||||||
|
<tr>
|
||||||
|
<th scope="row">${_("Paid Executive Education")}</th><td>${modes['paid-executive-education']}</td>
|
||||||
|
</tr>
|
||||||
|
%endif
|
||||||
%if modes['masters'] > 0:
|
%if modes['masters'] > 0:
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">${_("Master's")}</th><td>${modes['masters']}</td>
|
<th scope="row">${_("Master's")}</th><td>${modes['masters']}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user