Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature.nutmeg/jltang/configuration #216

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,7 @@
############### Settings for django file storage ##################
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'

QUALTRICS_SCORE_ID = None
###################### Grade Downloads ######################
# These keys are used for all of our asynchronous downloadable files, including
# the ones that contain information other than grades.
Expand Down
1 change: 1 addition & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import copy
import os
import warnings
#from os.path import abspath, dirname, join
import yaml

from corsheaders.defaults import default_headers as corsheaders_default_headers
Expand Down
28 changes: 28 additions & 0 deletions common/djangoapps/student/migrations/0044_auto_20220808_2144.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.13 on 2022-08-08 21:44

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('student', '0043_remove_userprofile_allow_certificate'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='gender',
field=models.CharField(blank=True, choices=[('m', 'Male'), ('f', 'Female'), ('nbtg', 'Non-binary / third gender'), ('prefer-not-to-say', 'Prefer not to say'), ('o', 'Other')], db_index=True, max_length=25, null=True),
),
migrations.AlterField(
model_name='userprofile',
name='level_of_education',
field=models.CharField(blank=True, choices=[('some-hs', 'Some high school'), ('hs', 'High School or GED'), ('some-college', 'Some college'), ('a', '2-year degree'), ('b', '4-year degree'), ('m', "Master's"), ('p', 'Doctorate'), ('jd-md', 'Professional degree (J.D., M.D.)'), ('prefer-not-to-say', 'Prefer not to say')], db_index=True, max_length=25, null=True),
),
migrations.AddField(
model_name='courseenrollmentcelebration',
name='celebrate_weekly_goal',
field=models.BooleanField(default=False),
),
]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.13 on 2022-08-12 17:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('student', '0044_auto_20220808_2144'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='gender',
field=models.CharField(blank=True, choices=[('m', 'Male'), ('f', 'Female'), ('nbtg', 'Non-binary / third gender'), ('prefer-not-to-say', 'Prefer not to say')], db_index=True, max_length=25, null=True),
),
]
31 changes: 17 additions & 14 deletions common/djangoapps/student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,39 +530,42 @@ class Meta:

# Optional demographic data we started capturing from Fall 2012
this_year = datetime.now(UTC).year
VALID_YEARS = list(range(this_year, this_year - 120, -1))
starting_year = 1923
VALID_YEARS = list(range(starting_year, this_year + 1))
year_of_birth = models.IntegerField(blank=True, null=True, db_index=True)
GENDER_CHOICES = (
('m', gettext_noop('Male')),
('f', gettext_noop('Female')),
('nbtg', gettext_noop('Non-binary / third gender')),
# Translators: 'Other' refers to the student's gender
('o', gettext_noop('Other/Prefer Not to Say'))
# ('o', gettext_noop('Self-describe/other')) # TODO - Need to change this option to a freetext input
('prefer-not-to-say', gettext_noop('Prefer not to say'))
)
gender = models.CharField(
blank=True, null=True, max_length=6, db_index=True, choices=GENDER_CHOICES
blank=True, null=True, max_length=25, db_index=True, choices=GENDER_CHOICES
)

# [03/21/2013] removed these, but leaving comment since there'll still be
# p_se and p_oth in the existing data in db.
# ('p_se', 'Doctorate in science or engineering'),
# ('p_oth', 'Doctorate in another field'),
LEVEL_OF_EDUCATION_CHOICES = (
('some-hs', gettext_noop("Some high school")),
('hs', gettext_noop("High School or GED")),
('some-college', gettext_noop("Some college")),
('a', gettext_noop("2-year degree")),
('b', gettext_noop("4-year degree")),
('m', gettext_noop("Master's")),
('p', gettext_noop('Doctorate')),
('m', gettext_noop("Master's or professional degree")),
('b', gettext_noop("Bachelor's degree")),
('a', gettext_noop("Associate degree")),
('hs', gettext_noop("Secondary/high school")),
('jhs', gettext_noop("Junior secondary/junior high/middle school")),
('el', gettext_noop("Elementary/primary school")),
# Translators: 'None' refers to the student's level of education
('none', gettext_noop("No formal education")),
# Translators: 'Other' refers to the student's level of education
('other', gettext_noop("Other education"))
('jd-md', gettext_noop("Professional degree (J.D., M.D.)")),
('prefer-not-to-say', gettext_noop("Prefer not to say")),
)

level_of_education = models.CharField(
blank=True, null=True, max_length=6, db_index=True,
blank=True, null=True, max_length=25, db_index=True,
choices=LEVEL_OF_EDUCATION_CHOICES
)

mailing_address = models.TextField(blank=True, null=True)
city = models.TextField(blank=True, null=True)
country = CountryField(blank=True, null=True)
Expand Down
4 changes: 2 additions & 2 deletions common/djangoapps/student/tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def test_change_many_fields(self):
Verify that we emit one event per field when many fields change on the
user profile in one transaction.
"""
self.profile.gender = 'o'
self.profile.gender = 'prefer-not-to-say'
self.profile.bio = 'test bio'
self.profile.save()
self.assert_user_setting_event_emitted(setting='bio', old=None, new=self.profile.bio)
self.assert_user_setting_event_emitted(setting='gender', old='m', new='o')
self.assert_user_setting_event_emitted(setting='gender', old='m', new='prefer-not-to-say')

def test_unicode(self):
"""
Expand Down
9 changes: 9 additions & 0 deletions lms/djangoapps/branding/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.db import transaction
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django.urls import reverse
from django.urls.exceptions import NoReverseMatch
from django.utils import translation
from django.utils.translation.trans_real import get_supported_language_variant
Expand All @@ -34,6 +35,14 @@ def index(request):
"""
Redirects to main page -- info page if user authenticated, or marketing if not
"""
# This is to redirect Microsites when a homepage is not necessarily needed.
if not request.user.is_authenticated:
if configuration_helpers.get_value(
'ALWAYS_REDIRECT_HOMEPAGE_TO_LOGIN_FOR_UNAUTHENTICATED_USER',
settings.FEATURES.get('ALWAYS_REDIRECT_HOMEPAGE_TO_LOGIN_FOR_UNAUTHENTICATED_USER', True)
):
return redirect(reverse('signin_user'))

if request.user.is_authenticated:
# Only redirect to dashboard if user has
# courses in their dashboard. Otherwise UX is a bit cryptic.
Expand Down
5 changes: 5 additions & 0 deletions lms/djangoapps/courseware/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ def get_last_accessed_courseware(course, request, user):
if SelfPacedConfiguration.current().enable_course_home_improvements:
context['resume_course_url'] = get_last_accessed_courseware(course, request, user)

# Redirect to Resume Course url if site configuration flag is enabled.
if context['resume_course_url'] and configuration_helpers.get_value(
'ENABLE_REDIRECT_TO_RESUME_COURSE_ON_COURSE_INFO', False):
return redirect(context['resume_course_url'])

if not check_course_open_for_learner(user, course):
# Disable student view button if user is staff and
# course is not yet visible to students.
Expand Down
6 changes: 6 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@
# .. toggle_tickets: https://github.com/edx/edx-platform/pull/5220
'ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER': True,

# When an non logged in user (Anonymous) goes to the homepage ('/') shoud the user be
# redirected to the dashboard - this is default Microsite behaviour for EducateWorkforce.
# Set to False to not redirect the user.
'ALWAYS_REDIRECT_HOMEPAGE_TO_LOGIN_FOR_UNAUTHENTICATED_USER': False,

# .. toggle_name: FEATURES['ENABLE_COURSE_SORTING_BY_START_DATE']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
Expand Down Expand Up @@ -3601,6 +3606,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# .. toggle_warnings: Review FEATURES['ENABLE_OPENBADGES'] for further context.
BADGR_ENABLE_NOTIFICATIONS = False

QUALTRICS_SCORE_ID = None
###################### Grade Downloads ######################
# These keys are used for all of our asynchronous downloadable files, including
# the ones that contain information other than grades.
Expand Down
6 changes: 6 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import copy
import datetime
import os
from os.path import abspath, dirname, join

import yaml
from corsheaders.defaults import default_headers as corsheaders_default_headers
Expand Down Expand Up @@ -981,6 +982,11 @@ def get_env_setting(setting):
# Load production.py in plugins
add_plugins(__name__, ProjectType.LMS, SettingsType.PRODUCTION)

#####################################################################
# See if the developer has any local overrides.
if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')):
from .private import * # pylint: disable=import-error,wildcard-import

############## Settings for Completion API #########################

# Once a user has watched this percentage of a video, mark it as complete:
Expand Down
4 changes: 4 additions & 0 deletions lms/envs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@

# enable /api/v1/save/course/ api for testing
ENABLE_SAVE_FOR_LATER = True
#################### Network configuration ####################
# Tests are not behind any proxies
CLOSEST_CLIENT_IP_FROM_HEADERS = []


# rate limit for /api/v1/save/course/ api
SAVE_FOR_LATER_IP_RATE_LIMIT = '5/d'
Expand Down
30 changes: 24 additions & 6 deletions lms/static/sass/views/_login-register.scss
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,32 @@ ul.fa-ul{
margin: ($baseline/2) 0 0 0;


&.select-year_of_birth {
@include margin-left(15px);
// &.select-year_of_birth {
// @include margin-left(15px);
// }

// &.select-gender,
// &.select-year_of_birth {
// display: inline-block;
// width: calc(50% - 10px);
// }

&.select-level_of_education {
select#register-level_of_education {
height: 60px !important;
}
}

&.select-gender,
&.select-year_of_birth {
display: inline-block;
width: calc(50% - 10px);
&.select-ethnicity {
select#register-ethnicity {
height: 60px !important;
}
}

&.select-local_community_living {
select#register-local_community_living {
height: 80px !important;
}
}

&.checkbox-marketing_emails_opt_in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def test_patch_account_unknown_user(self, api_client, user):

@ddt.data(
("gender", "f", "not a gender", '"not a gender" is not a valid choice.'),
("level_of_education", "none", "ȻħȺɍłɇs", '"ȻħȺɍłɇs" is not a valid choice.'),
("level_of_education", "prefer-not-to-say", "ȻħȺɍłɇs", '"ȻħȺɍłɇs" is not a valid choice.'),
("country", "GB", "XY", '"XY" is not a valid choice.'),
("state", "MA", "PY", '"PY" is not a valid choice.'),
("year_of_birth", 2009, "not_an_int", "A valid integer is required."),
Expand Down
6 changes: 3 additions & 3 deletions openedx/core/djangoapps/user_authn/views/registration_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def _add_level_of_education_field(self, form_desc, required=True):
"""
# Translators: This label appears above a dropdown menu on the registration
# form used to select the user's highest completed level of education.
education_level_label = _("Highest level of education completed")
education_level_label = _("What is the highest level of education you have completed?")
error_msg = accounts.REQUIRED_FIELD_LEVEL_OF_EDUCATION_MSG

# The labels are marked for translation in UserProfile model definition.
Expand Down Expand Up @@ -639,7 +639,7 @@ def _add_gender_field(self, form_desc, required=True):
"""
# Translators: This label appears above a dropdown menu on the registration
# form used to select the user's gender.
gender_label = _("Gender")
gender_label = _("How do you describe yourself?")

# The labels are marked for translation in UserProfile model definition.
# pylint: disable=translation-of-non-string
Expand All @@ -662,7 +662,7 @@ def _add_year_of_birth_field(self, form_desc, required=True):
"""
# Translators: This label appears above a dropdown menu on the registration
# form used to select the user's year of birth.
yob_label = _("Year of birth")
yob_label = _("What year were you born?")

options = [(str(year), str(year)) for year in UserProfile.VALID_YEARS]
form_desc.add_field(
Expand Down
Loading
Loading