From 4c9d46e98cb70ba6ce51893fd7a4eba2dbcb0bea Mon Sep 17 00:00:00 2001 From: Muhammad Nadeem Date: Mon, 12 Mar 2018 15:22:06 +0500 Subject: [PATCH 1/6] Disable is_currently_employed checkbox at registration page if user is landing here for admin registration --- lms/djangoapps/onboarding/forms.py | 2 +- lms/djangoapps/philu_overrides/views.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/onboarding/forms.py b/lms/djangoapps/onboarding/forms.py index a65d200cf6e3..294f57276469 100644 --- a/lms/djangoapps/onboarding/forms.py +++ b/lms/djangoapps/onboarding/forms.py @@ -748,7 +748,7 @@ def save(self, user=None, commit=True): class OrganizationMetricModelForm(BaseOnboardingModelForm): - can_provide_info = forms.ChoiceField(label=ugettext_noop('Are you able to provide information requested bellow?'), + can_provide_info = forms.ChoiceField(label=ugettext_noop('Are you able to provide information requested below?'), choices=((1, ugettext_noop('Yes')), (0, ugettext_noop('No'))), label_suffix="*", widget=forms.RadioSelect, diff --git a/lms/djangoapps/philu_overrides/views.py b/lms/djangoapps/philu_overrides/views.py index 276f96d89fbc..3822c882db7d 100644 --- a/lms/djangoapps/philu_overrides/views.py +++ b/lms/djangoapps/philu_overrides/views.py @@ -160,12 +160,14 @@ def login_and_registration_form(request, initial_mode="login", org_name=None, ad email_field = get_form_field_by_name(registration_fields, 'email') org_field = get_form_field_by_name(registration_fields, 'organization_name') + is_currently_employed_field = get_form_field_by_name(registration_fields, 'is_currently_employed') is_poc_field = get_form_field_by_name(registration_fields, 'is_poc') email_field['defaultValue'] = admin_email org_field['defaultValue'] = org_name is_poc_field['defaultValue'] = "1" - context['fields_to_disable'] = json.dumps([email_field['name'], org_field['name'], is_poc_field['name']]) + context['fields_to_disable'] = json.dumps([email_field['name'], org_field['name'], + is_currently_employed_field['name'], is_poc_field['name']]) return render_to_response('student_account/login_and_register.html', context) From a1eeb5c6869d0b227a82383b089f3a5e8a6be9fc Mon Sep 17 00:00:00 2001 From: Muhammad Osama Arshad Date: Mon, 12 Mar 2018 18:09:53 +0500 Subject: [PATCH 2/6] Fix: proper course access link (#390) --- lms/djangoapps/philu_overrides/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/philu_overrides/views.py b/lms/djangoapps/philu_overrides/views.py index 3822c882db7d..3c24565d0ae3 100644 --- a/lms/djangoapps/philu_overrides/views.py +++ b/lms/djangoapps/philu_overrides/views.py @@ -208,11 +208,21 @@ def courses_custom(request): course.id.to_deprecated_string()) with modulestore().bulk_operations(course_key): if has_access(request.user, 'load', course): - course.course_target = get_last_accessed_courseware( + access_link = get_last_accessed_courseware( get_course_by_id(course_key, 0), request, request.user ) + + first_chapter_url, first_section = get_course_related_keys( + request, get_course_by_id(course_key, 0)) + first_target = reverse('courseware_section', args=[ + course.id.to_deprecated_string(), + first_chapter_url, + first_section + ]) + + course.course_target = access_link if access_link != None else first_target else: course.course_target = '/courses/' + course.id.to_deprecated_string() From 9b2951948776dedd29c65400e8b5a25af5de6997 Mon Sep 17 00:00:00 2001 From: Muhammad Nadeem Date: Mon, 12 Mar 2018 19:03:32 +0500 Subject: [PATCH 3/6] Revert: Disable is_currently_employed checkbox at registration page if user is landing here for admin registration --- lms/djangoapps/philu_overrides/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lms/djangoapps/philu_overrides/views.py b/lms/djangoapps/philu_overrides/views.py index 3822c882db7d..276f96d89fbc 100644 --- a/lms/djangoapps/philu_overrides/views.py +++ b/lms/djangoapps/philu_overrides/views.py @@ -160,14 +160,12 @@ def login_and_registration_form(request, initial_mode="login", org_name=None, ad email_field = get_form_field_by_name(registration_fields, 'email') org_field = get_form_field_by_name(registration_fields, 'organization_name') - is_currently_employed_field = get_form_field_by_name(registration_fields, 'is_currently_employed') is_poc_field = get_form_field_by_name(registration_fields, 'is_poc') email_field['defaultValue'] = admin_email org_field['defaultValue'] = org_name is_poc_field['defaultValue'] = "1" - context['fields_to_disable'] = json.dumps([email_field['name'], org_field['name'], - is_currently_employed_field['name'], is_poc_field['name']]) + context['fields_to_disable'] = json.dumps([email_field['name'], org_field['name'], is_poc_field['name']]) return render_to_response('student_account/login_and_register.html', context) From 9220627c3ac0f6a1a882d60badbce3d5ab29c31a Mon Sep 17 00:00:00 2001 From: Muhammad Nadeem Date: Mon, 12 Mar 2018 20:08:44 +0500 Subject: [PATCH 4/6] Increase community_url max_length and add model at admin --- common/djangoapps/nodebb/admin.py | 11 ++++++ .../migrations/0003_auto_20180312_1021.py | 19 +++++++++++ common/djangoapps/nodebb/models.py | 2 +- .../oef/migrations/0011_auto_20180312_1021.py | 24 +++++++++++++ .../migrations/0013_auto_20180312_1021.py | 34 +++++++++++++++++++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 common/djangoapps/nodebb/admin.py create mode 100644 common/djangoapps/nodebb/migrations/0003_auto_20180312_1021.py create mode 100644 lms/djangoapps/oef/migrations/0011_auto_20180312_1021.py create mode 100644 lms/djangoapps/onboarding/migrations/0013_auto_20180312_1021.py diff --git a/common/djangoapps/nodebb/admin.py b/common/djangoapps/nodebb/admin.py new file mode 100644 index 000000000000..fb655cd14154 --- /dev/null +++ b/common/djangoapps/nodebb/admin.py @@ -0,0 +1,11 @@ +from django.contrib import admin + +from models import DiscussionCommunity + + +class DiscussionCommunityAdmin(admin.ModelAdmin): + list_display = ('course_id', 'community_url', ) + + +admin.site.register(DiscussionCommunity, DiscussionCommunityAdmin) + diff --git a/common/djangoapps/nodebb/migrations/0003_auto_20180312_1021.py b/common/djangoapps/nodebb/migrations/0003_auto_20180312_1021.py new file mode 100644 index 000000000000..b4662557600d --- /dev/null +++ b/common/djangoapps/nodebb/migrations/0003_auto_20180312_1021.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('nodebb', '0002_teamgroupchat'), + ] + + operations = [ + migrations.AlterField( + model_name='discussioncommunity', + name='community_url', + field=models.CharField(unique=True, max_length=255), + ), + ] diff --git a/common/djangoapps/nodebb/models.py b/common/djangoapps/nodebb/models.py index 9a7022068f9b..d894bda3923c 100644 --- a/common/djangoapps/nodebb/models.py +++ b/common/djangoapps/nodebb/models.py @@ -14,7 +14,7 @@ class DiscussionCommunity(TimeStampedModel): """ course_id = CourseKeyField(max_length=255, db_index=True) - community_url = models.CharField(max_length=100, unique=True) + community_url = models.TextField(max_length=255, unique=True) def __str__(self): return "%s" % self.community_url diff --git a/lms/djangoapps/oef/migrations/0011_auto_20180312_1021.py b/lms/djangoapps/oef/migrations/0011_auto_20180312_1021.py new file mode 100644 index 000000000000..a1a3caf67bbc --- /dev/null +++ b/lms/djangoapps/oef/migrations/0011_auto_20180312_1021.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oef', '0010_load_instructions'), + ] + + operations = [ + migrations.AlterField( + model_name='oefsurvey', + name='description', + field=models.TextField(), + ), + migrations.AlterField( + model_name='topicquestion', + name='score_name', + field=models.CharField(max_length=50), + ), + ] diff --git a/lms/djangoapps/onboarding/migrations/0013_auto_20180312_1021.py b/lms/djangoapps/onboarding/migrations/0013_auto_20180312_1021.py new file mode 100644 index 000000000000..32f3015d3e1f --- /dev/null +++ b/lms/djangoapps/onboarding/migrations/0013_auto_20180312_1021.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('onboarding', '0012_auto_20180228_0848'), + ] + + operations = [ + migrations.AlterField( + model_name='historicaluserextendedprofile', + name='function_stakeholder_engagement', + field=models.SmallIntegerField(default=0, verbose_name=b'External relations and partnerships'), + ), + migrations.AlterField( + model_name='historicaluserextendedprofile', + name='interest_stakeholder_engagement', + field=models.SmallIntegerField(default=0, verbose_name=b'External relations and partnerships'), + ), + migrations.AlterField( + model_name='userextendedprofile', + name='function_stakeholder_engagement', + field=models.SmallIntegerField(default=0, verbose_name=b'External relations and partnerships'), + ), + migrations.AlterField( + model_name='userextendedprofile', + name='interest_stakeholder_engagement', + field=models.SmallIntegerField(default=0, verbose_name=b'External relations and partnerships'), + ), + ] From 15d65853b3022ab676a8b6cb37ed2f95fcc4ddf2 Mon Sep 17 00:00:00 2001 From: Muhammad Osama Arshad Date: Mon, 12 Mar 2018 20:33:39 +0500 Subject: [PATCH 5/6] Fix: use correct username in NodeBB API call (#394) * Fix: use correct username in NodeBB API call * Improve: limit height and width of profile image * Fix: remove bad css practice --- lms/djangoapps/philu_api/views.py | 2 +- .../teams/static/teams/templates/team-member.underscore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/philu_api/views.py b/lms/djangoapps/philu_api/views.py index f6d1157dae08..ab5457f6b4b9 100644 --- a/lms/djangoapps/philu_api/views.py +++ b/lms/djangoapps/philu_api/views.py @@ -121,7 +121,7 @@ def mark_user_chat_read(request): def get_user_data(request): """ Get the user profile data from NodeBB for current user """ data_endpoint = settings.NODEBB_ENDPOINT + '/api/v2/users/data' - username = request.user.username + username = request.POST.get("username") headers = {'Authorization': 'Bearer ' + settings.NODEBB_MASTER_TOKEN} response = requests.post(data_endpoint, data={'_uid': 1, 'username': username}, diff --git a/lms/djangoapps/teams/static/teams/templates/team-member.underscore b/lms/djangoapps/teams/static/teams/templates/team-member.underscore index f53e4734fb8a..7f594a94992c 100644 --- a/lms/djangoapps/teams/static/teams/templates/team-member.underscore +++ b/lms/djangoapps/teams/static/teams/templates/team-member.underscore @@ -2,7 +2,7 @@

<%= username %>

- profile page + profile page
From eaf44e3759455d4511c7da0d76f4321412c21f3f Mon Sep 17 00:00:00 2001 From: Muhammad Nadee Date: Mon, 12 Mar 2018 20:55:57 +0500 Subject: [PATCH 6/6] Typo --- common/djangoapps/nodebb/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/nodebb/models.py b/common/djangoapps/nodebb/models.py index d894bda3923c..ed65c7b98bb1 100644 --- a/common/djangoapps/nodebb/models.py +++ b/common/djangoapps/nodebb/models.py @@ -14,7 +14,7 @@ class DiscussionCommunity(TimeStampedModel): """ course_id = CourseKeyField(max_length=255, db_index=True) - community_url = models.TextField(max_length=255, unique=True) + community_url = models.CharField(max_length=255, unique=True) def __str__(self): return "%s" % self.community_url