diff --git a/common/djangoapps/util/testing.py b/common/djangoapps/util/testing.py index 9abd89ae26..083034c967 100644 --- a/common/djangoapps/util/testing.py +++ b/common/djangoapps/util/testing.py @@ -100,7 +100,6 @@ class EventTestMixin(object): self.mock_tracker.reset_mock() -<<<<<<< HEAD class PatchMediaTypeMixin(object): """ Generic mixin for verifying unsupported media type in PATCH @@ -112,7 +111,8 @@ class PatchMediaTypeMixin(object): content_type=self.unsupported_media_type ) self.assertEqual(response.status_code, 415) -======= + + def patch_testcase(): """ Disable commit_on_success decorators for tests in TestCase subclasses. @@ -159,4 +159,3 @@ def patch_testcase(): # pylint: disable=protected-access TestCase._enter_atomics = enter_atomics_wrapper(TestCase._enter_atomics) TestCase._rollback_atomics = rollback_atomics_wrapper(TestCase._rollback_atomics) ->>>>>>> origin/release diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 4539d51ad2..a6fb2113c3 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2643,51 +2643,6 @@ def enable_certificate_generation(request, course_id=None): return redirect(_instructor_dash_url(course_key, section='certificates')) -<<<<<<< HEAD -======= -#---- Gradebook (shown to small courses only) ---- -# Grades can potentially be written - if so, let grading manage the transaction. -@transaction.non_atomic_requests -@cache_control(no_cache=True, no_store=True, must_revalidate=True) -@require_level('staff') -def spoc_gradebook(request, course_id): - """ - Show the gradebook for this course: - - Only shown for courses with enrollment < settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") - - Only displayed to course staff - """ - course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id) - course = get_course_with_access(request.user, 'staff', course_key, depth=None) - - enrolled_students = User.objects.filter( - courseenrollment__course_id=course_key, - courseenrollment__is_active=1 - ).order_by('username').select_related("profile") - - # possible extension: implement pagination to show to large courses - - student_info = [ - { - 'username': student.username, - 'id': student.id, - 'email': student.email, - 'grade_summary': student_grades(student, request, course), - 'realname': student.profile.name, - } - for student in enrolled_students - ] - - return render_to_response('courseware/gradebook.html', { - 'students': student_info, - 'course': course, - 'course_id': course_key, - # Checked above - 'staff_access': True, - 'ordered_grades': sorted(course.grade_cutoffs.items(), key=lambda i: i[1], reverse=True), - }) - - ->>>>>>> origin/release @ensure_csrf_cookie @cache_control(no_cache=True, no_store=True, must_revalidate=True) @require_level('staff') @@ -2770,6 +2725,7 @@ def start_certificate_regeneration(request, course_id): return JsonResponse(response_payload) +@transaction.non_atomic_requests @ensure_csrf_cookie @cache_control(no_cache=True, no_store=True, must_revalidate=True) @require_global_staff diff --git a/lms/djangoapps/instructor/views/gradebook_api.py b/lms/djangoapps/instructor/views/gradebook_api.py index 2d9e5fd0a2..f51cdfbd4b 100644 --- a/lms/djangoapps/instructor/views/gradebook_api.py +++ b/lms/djangoapps/instructor/views/gradebook_api.py @@ -6,6 +6,7 @@ import math from django.contrib.auth.models import User from django.core.urlresolvers import reverse +from django.db import transaction from django.views.decorators.cache import cache_control from opaque_keys.edx.keys import CourseKey @@ -96,6 +97,7 @@ def get_grade_book_page(request, course, course_key): return student_info, page +@transaction.non_atomic_requests @cache_control(no_cache=True, no_store=True, must_revalidate=True) @require_level('staff') def spoc_gradebook(request, course_id): diff --git a/lms/djangoapps/teams/tests/test_views.py b/lms/djangoapps/teams/tests/test_views.py index 53ad3a2df2..182ddffa58 100644 --- a/lms/djangoapps/teams/tests/test_views.py +++ b/lms/djangoapps/teams/tests/test_views.py @@ -129,11 +129,7 @@ class TestDashboard(SharedModuleStoreTestCase): team.add_user(self.user) # Check the query count on the dashboard again -<<<<<<< HEAD - with self.assertNumQueries(19): -======= - with self.assertNumQueries(24): ->>>>>>> origin/release + with self.assertNumQueries(23): self.client.get(self.teams_url) def test_bad_course_id(self): diff --git a/openedx/core/djangoapps/programs/migrations/0002_auto__add_field_programsapiconfig_cache_ttl.py b/openedx/core/djangoapps/programs/migrations/0002_auto__add_field_programsapiconfig_cache_ttl.py deleted file mode 100644 index 5f7b5cff94..0000000000 --- a/openedx/core/djangoapps/programs/migrations/0002_auto__add_field_programsapiconfig_cache_ttl.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'ProgramsApiConfig.cache_ttl' - db.add_column('programs_programsapiconfig', 'cache_ttl', - self.gf('django.db.models.fields.PositiveIntegerField')(default=0), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'ProgramsApiConfig.cache_ttl' - db.delete_column('programs_programsapiconfig', 'cache_ttl') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'programs.programsapiconfig': { - 'Meta': {'ordering': "('-change_date',)", 'object_name': 'ProgramsApiConfig'}, - 'api_version_number': ('django.db.models.fields.IntegerField', [], {}), - 'cache_ttl': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), - 'change_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'changed_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'on_delete': 'models.PROTECT'}), - 'enable_student_dashboard': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'internal_service_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), - 'public_service_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) - } - } - - complete_apps = ['programs'] diff --git a/openedx/core/djangoapps/programs/migrations/0002_programsapiconfig_cache_ttl.py b/openedx/core/djangoapps/programs/migrations/0002_programsapiconfig_cache_ttl.py new file mode 100644 index 0000000000..92e7f98433 --- /dev/null +++ b/openedx/core/djangoapps/programs/migrations/0002_programsapiconfig_cache_ttl.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('programs', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='programsapiconfig', + name='cache_ttl', + field=models.PositiveIntegerField(default=0, help_text='Specified in seconds. Enable caching by setting this to a value greater than 0.', verbose_name='Cache Time To Live'), + ), + ] diff --git a/openedx/core/djangoapps/programs/models.py b/openedx/core/djangoapps/programs/models.py index 4f7a8846c7..db9fa5caf1 100644 --- a/openedx/core/djangoapps/programs/models.py +++ b/openedx/core/djangoapps/programs/models.py @@ -20,8 +20,7 @@ class ProgramsApiConfig(ConfigurationModel): internal_service_url = URLField(verbose_name=_("Internal Service URL")) public_service_url = URLField(verbose_name=_("Public Service URL")) api_version_number = IntegerField(verbose_name=_("API Version")) -<<<<<<< HEAD - enable_student_dashboard = BooleanField(verbose_name=_("Enable Student Dashboard Displays")) + enable_student_dashboard = NullBooleanField(verbose_name=_("Enable Student Dashboard Displays")) cache_ttl = models.PositiveIntegerField( verbose_name=_("Cache Time To Live"), default=0, @@ -31,9 +30,6 @@ class ProgramsApiConfig(ConfigurationModel): ) PROGRAMS_API_CACHE_KEY = "programs.api.data" -======= - enable_student_dashboard = NullBooleanField(verbose_name=_("Enable Student Dashboard Displays")) ->>>>>>> origin/release @property def internal_api_url(self): diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index d19662827f..2ce732e056 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -306,11 +306,7 @@ class TestAccountAPI(UserAPITestCase): """ Internal helper to perform the actual assertions """ -<<<<<<< HEAD - with self.assertNumQueries(7): -======= - with self.assertNumQueries(10): ->>>>>>> origin/release + with self.assertNumQueries(9): response = self.send_get(self.client) data = response.data self.assertEqual(16, len(data)) @@ -349,11 +345,7 @@ class TestAccountAPI(UserAPITestCase): legacy_profile.save() self.client.login(username=self.user.username, password=self.test_password) -<<<<<<< HEAD - with self.assertNumQueries(7): -======= - with self.assertNumQueries(10): ->>>>>>> origin/release + with self.assertNumQueries(9): response = self.send_get(self.client) for empty_field in ("level_of_education", "gender", "country", "bio"): self.assertIsNone(response.data[empty_field]) diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index 1415d23720..851cbfb875 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -57,16 +57,9 @@ git+https://github.com/edx/edx-lint.git@v0.3.2#egg=edx_lint==0.3.2 -e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive -e git+https://github.com/edx/edx-reverification-block.git@ned/upgrade-django-1.8#egg=edx-reverification-block==0.0.5 -e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client -<<<<<<< HEAD -git+https://github.com/edx/edx-organizations.git@release-2015-11-17#egg=edx-organizations==0.1.7 - -git+https://github.com/edx/edx-proctoring.git@0.10.20#egg=edx-proctoring==0.10.20 - -======= git+https://github.com/edx/edx-organizations.git@ned/django-18#egg=edx-organizations==0.1.7 git+https://github.com/edx/edx-proctoring.git@django1.8-upgrade#egg=edx-proctoring==0.11.2 ->>>>>>> origin/release # Third Party XBlocks -e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga --e git+https://github.com/open-craft/xblock-poll@e7a6c95c300e95c51e42bfd1eba70489c05a6527#egg=xblock-poll +-e git+https://github.com/open-craft/xblock-poll@e7a6c95c300e95c51e42bfd1eba70489c05a6527#egg=xblock-poll \ No newline at end of file