Commit 39fd8350 by Tyler Hallada

Upgrade to Django 1.8

parent d01ec6a8
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
name='user',
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(max_length=254, verbose_name='email address', blank=True),
),
migrations.AlterField(
model_name='user',
name='groups',
field=models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', verbose_name='groups'),
),
migrations.AlterField(
model_name='user',
name='last_login',
field=models.DateTimeField(null=True, verbose_name='last login', blank=True),
),
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, verbose_name='username'),
),
]
...@@ -6,6 +6,7 @@ import mock ...@@ -6,6 +6,7 @@ import mock
from django.core.cache import cache from django.core.cache import cache
from django.core.urlresolvers import reverse, reverse_lazy from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.http import urlquote
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.db import DatabaseError from django.db import DatabaseError
...@@ -44,7 +45,7 @@ class UserTestCaseMixin(object): ...@@ -44,7 +45,7 @@ class UserTestCaseMixin(object):
def assertUserLoggedIn(self, user): def assertUserLoggedIn(self, user):
""" Verifies that the specified user is logged in with the test client. """ """ Verifies that the specified user is logged in with the test client. """
self.assertEqual(self.client.session['_auth_user_id'], user.pk) self.assertEqual(int(self.client.session['_auth_user_id']), user.pk)
def setUp(self): def setUp(self):
super(UserTestCaseMixin, self).setUp() super(UserTestCaseMixin, self).setUp()
...@@ -54,7 +55,8 @@ class UserTestCaseMixin(object): ...@@ -54,7 +55,8 @@ class UserTestCaseMixin(object):
class RedirectTestCaseMixin(object): class RedirectTestCaseMixin(object):
def assertRedirectsNoFollow(self, response, expected_url, status_code=302, **querystringkwargs): def assertRedirectsNoFollow(self, response, expected_url, status_code=302, **querystringkwargs):
if querystringkwargs: if querystringkwargs:
expected_url += '?{}'.format('&'.join('%s=%s' % (key, value) for (key, value) in querystringkwargs.items())) expected_url += '?{}'.format('&'.join('%s=%s' % (key, urlquote(value))
for (key, value) in querystringkwargs.items()))
self.assertEqual(response['Location'], 'http://testserver{}'.format(expected_url)) self.assertEqual(response['Location'], 'http://testserver{}'.format(expected_url))
self.assertEqual(response.status_code, status_code) self.assertEqual(response.status_code, status_code)
...@@ -88,7 +90,8 @@ class ViewTests(TestCase): ...@@ -88,7 +90,8 @@ class ViewTests(TestCase):
l.check() l.check()
@mock.patch('analyticsclient.status.Status.healthy', mock.PropertyMock(return_value=True)) @mock.patch('analyticsclient.status.Status.healthy', mock.PropertyMock(return_value=True))
@mock.patch('django.db.backends.BaseDatabaseWrapper.cursor', mock.Mock(side_effect=DatabaseError('example error'))) @mock.patch('django.db.backends.base.base.BaseDatabaseWrapper.cursor',
mock.Mock(side_effect=DatabaseError('example error')))
def test_health_database_outage(self): def test_health_database_outage(self):
with LogCapture(level=logging.ERROR) as l: with LogCapture(level=logging.ERROR) as l:
self.verify_health_response( self.verify_health_response(
...@@ -117,7 +120,8 @@ class ViewTests(TestCase): ...@@ -117,7 +120,8 @@ class ViewTests(TestCase):
)) ))
@mock.patch('analyticsclient.status.Status.healthy', mock.PropertyMock(return_value=False)) @mock.patch('analyticsclient.status.Status.healthy', mock.PropertyMock(return_value=False))
@mock.patch('django.db.backends.BaseDatabaseWrapper.cursor', mock.Mock(side_effect=DatabaseError('example error'))) @mock.patch('django.db.backends.base.base.BaseDatabaseWrapper.cursor',
mock.Mock(side_effect=DatabaseError('example error')))
def test_health_both_unavailable(self): def test_health_both_unavailable(self):
with LogCapture(level=logging.ERROR) as l: with LogCapture(level=logging.ERROR) as l:
self.verify_health_response( self.verify_health_response(
......
import urllib
import uuid import uuid
from slugify import slugify from slugify import slugify
...@@ -39,8 +38,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -39,8 +38,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
'id': _id, 'id': _id,
'name': block['display_name'], 'name': block['display_name'],
'part_ids': [part_id], 'part_ids': [part_id],
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, assignment['id'], _id, part_id)) self.course_id, assignment['id'], _id, part_id)
}) })
num_problems = len(problems) num_problems = len(problems)
...@@ -61,8 +60,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -61,8 +60,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
'average_submissions': num_problems / num_problems_float, 'average_submissions': num_problems / num_problems_float,
'average_correct_submissions': num_problems / num_problems_float, 'average_correct_submissions': num_problems / num_problems_float,
'average_incorrect_submissions': 0.0, 'average_incorrect_submissions': 0.0,
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, assignment['id'])) self.course_id, assignment['id'])
} }
presented.append(presented_assignment) presented.append(presented_assignment)
...@@ -98,7 +97,7 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -98,7 +97,7 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
return [ return [
{ {
'name': gp['assignment_type'], 'name': gp['assignment_type'],
'url': urllib.quote(url_template.format(self.course_id, slugify(gp['assignment_type']))) 'url': url_template.format(self.course_id, slugify(gp['assignment_type']))
} for gp in policies } for gp in policies
] ]
...@@ -131,9 +130,9 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -131,9 +130,9 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
'name': block['display_name'], 'name': block['display_name'],
'part_ids': [part_id], 'part_ids': [part_id],
'children': [], 'children': [],
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'], self.course_id, section['id'],
subsection['id'], _id, part_id)) subsection['id'], _id, part_id)
}) })
num_problems = len(problems) num_problems = len(problems)
...@@ -153,9 +152,9 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -153,9 +152,9 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
'average_submissions': num_problems / num_problems_float, 'average_submissions': num_problems / num_problems_float,
'average_correct_submissions': num_problems / num_problems_float, 'average_correct_submissions': num_problems / num_problems_float,
'average_incorrect_submissions': 0.0, 'average_incorrect_submissions': 0.0,
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'], self.course_id, section['id'],
subsection['id'])) subsection['id'])
} }
subsections.append(presented_subsection) subsections.append(presented_subsection)
...@@ -176,8 +175,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory): ...@@ -176,8 +175,8 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
'average_submissions': num_problems / num_problems_float, 'average_submissions': num_problems / num_problems_float,
'average_correct_submissions': num_problems / num_problems_float, 'average_correct_submissions': num_problems / num_problems_float,
'average_incorrect_submissions': 0.0, 'average_incorrect_submissions': 0.0,
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'])) self.course_id, section['id'])
} }
presented.append(presented_sections) presented.append(presented_sections)
...@@ -215,9 +214,9 @@ class CourseEngagementDataFactory(CourseStructureFactory): ...@@ -215,9 +214,9 @@ class CourseEngagementDataFactory(CourseStructureFactory):
'id': _id, 'id': _id,
'name': block['display_name'], 'name': block['display_name'],
'children': [], 'children': [],
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'], self.course_id, section['id'],
subsection['id'], _id)), subsection['id'], _id),
'pipeline_video_id': 'edX/DemoX/Demo_Course|i4x-edX_Demo_Course-video-{}'.format( 'pipeline_video_id': 'edX/DemoX/Demo_Course|i4x-edX_Demo_Course-video-{}'.format(
uuid.uuid4().hex) uuid.uuid4().hex)
}) })
...@@ -232,9 +231,9 @@ class CourseEngagementDataFactory(CourseStructureFactory): ...@@ -232,9 +231,9 @@ class CourseEngagementDataFactory(CourseStructureFactory):
'num_modules': num_videos, 'num_modules': num_videos,
'users_at_start': 10, 'users_at_start': 10,
'users_at_end': 0, 'users_at_end': 0,
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'], self.course_id, section['id'],
subsection['id'])) subsection['id'])
} }
subsections.append(presented_subsection) subsections.append(presented_subsection)
...@@ -247,8 +246,8 @@ class CourseEngagementDataFactory(CourseStructureFactory): ...@@ -247,8 +246,8 @@ class CourseEngagementDataFactory(CourseStructureFactory):
'num_modules': 1, 'num_modules': 1,
'users_at_start': 10, 'users_at_start': 10,
'users_at_end': 0, 'users_at_end': 0,
'url': urllib.quote(url_template.format( 'url': url_template.format(
self.course_id, section['id'])) self.course_id, section['id'])
} }
presented.append(presented_sections) presented.append(presented_sections)
......
import json import json
import logging import logging
from urllib import quote_plus
from ddt import data, ddt from ddt import data, ddt
import httpretty import httpretty
...@@ -56,7 +55,7 @@ class LearnersViewTests(ViewTestMixin, SwitchMixin, TestCase): ...@@ -56,7 +55,7 @@ class LearnersViewTests(ViewTestMixin, SwitchMixin, TestCase):
default_expected_context_subset = { default_expected_context_subset = {
'learner_list_url': '/api/learner_analytics/v0/learners/', 'learner_list_url': '/api/learner_analytics/v0/learners/',
'course_learner_metadata_url': '/api/learner_analytics/v0/course_learner_metadata/{course_id}/'.format( 'course_learner_metadata_url': '/api/learner_analytics/v0/course_learner_metadata/{course_id}/'.format(
course_id=quote_plus(DEMO_COURSE_ID) course_id=DEMO_COURSE_ID
), ),
} }
self.assertDictContainsSubset( self.assertDictContainsSubset(
......
# pylint: disable=no-value-for-parameter # pylint: disable=no-value-for-parameter
from django.conf import settings from django.conf import settings
from django.conf.urls import url, patterns, include from django.conf.urls import url, include
from courses import views from courses import views
from courses.views import enrollment, engagement, performance, csv, learners from courses.views import enrollment, engagement, performance, csv, learners
...@@ -27,18 +27,16 @@ video_timeline_regex = \ ...@@ -27,18 +27,16 @@ video_timeline_regex = \
r'^videos/sections/{}/subsections/{}/modules/{}/timeline/$'.format( r'^videos/sections/{}/subsections/{}/modules/{}/timeline/$'.format(
SECTION_ID_PATTERN, SUBSECTION_ID_PATTERN, VIDEO_ID_PATTERN) SECTION_ID_PATTERN, SUBSECTION_ID_PATTERN, VIDEO_ID_PATTERN)
ENROLLMENT_URLS = patterns( ENROLLMENT_URLS = [
'',
url(r'^activity/$', enrollment.EnrollmentActivityView.as_view(), name='activity'), url(r'^activity/$', enrollment.EnrollmentActivityView.as_view(), name='activity'),
url(r'^geography/$', enrollment.EnrollmentGeographyView.as_view(), name='geography'), url(r'^geography/$', enrollment.EnrollmentGeographyView.as_view(), name='geography'),
url(r'^demographics/age/$', enrollment.EnrollmentDemographicsAgeView.as_view(), name='demographics_age'), url(r'^demographics/age/$', enrollment.EnrollmentDemographicsAgeView.as_view(), name='demographics_age'),
url(r'^demographics/education/$', enrollment.EnrollmentDemographicsEducationView.as_view(), url(r'^demographics/education/$', enrollment.EnrollmentDemographicsEducationView.as_view(),
name='demographics_education'), name='demographics_education'),
url(r'^demographics/gender/$', enrollment.EnrollmentDemographicsGenderView.as_view(), name='demographics_gender'), url(r'^demographics/gender/$', enrollment.EnrollmentDemographicsGenderView.as_view(), name='demographics_gender'),
) ]
ENGAGEMENT_URLS = patterns( ENGAGEMENT_URLS = [
'',
url(r'^content/$', engagement.EngagementContentView.as_view(), name='content'), url(r'^content/$', engagement.EngagementContentView.as_view(), name='content'),
url(r'^videos/$', engagement.EngagementVideoCourse.as_view(), name='videos'), url(r'^videos/$', engagement.EngagementVideoCourse.as_view(), name='videos'),
# ordering of the URLS is important for routing the the section, subsection, etc. correctly # ordering of the URLS is important for routing the the section, subsection, etc. correctly
...@@ -49,10 +47,9 @@ ENGAGEMENT_URLS = patterns( ...@@ -49,10 +47,9 @@ ENGAGEMENT_URLS = patterns(
url(r'^videos/sections/{}/$'.format(SECTION_ID_PATTERN), url(r'^videos/sections/{}/$'.format(SECTION_ID_PATTERN),
engagement.EngagementVideoSection.as_view(), engagement.EngagementVideoSection.as_view(),
name='video_section'), name='video_section'),
) ]
PERFORMANCE_URLS = patterns( PERFORMANCE_URLS = [
'',
url(r'^ungraded_content/$', performance.PerformanceUngradedContent.as_view(), name='ungraded_content'), url(r'^ungraded_content/$', performance.PerformanceUngradedContent.as_view(), name='ungraded_content'),
url(ungraded_answer_distribution_regex, performance.PerformanceUngradedAnswerDistribution.as_view(), url(ungraded_answer_distribution_regex, performance.PerformanceUngradedAnswerDistribution.as_view(),
name='ungraded_answer_distribution'), name='ungraded_answer_distribution'),
...@@ -73,10 +70,9 @@ PERFORMANCE_URLS = patterns( ...@@ -73,10 +70,9 @@ PERFORMANCE_URLS = patterns(
url(r'^graded_content/assignments/{}/$'.format(ASSIGNMENT_ID_PATTERN), url(r'^graded_content/assignments/{}/$'.format(ASSIGNMENT_ID_PATTERN),
performance.PerformanceAssignment.as_view(), performance.PerformanceAssignment.as_view(),
name='assignment'), name='assignment'),
) ]
CSV_URLS = patterns( CSV_URLS = [
'',
url(r'^enrollment/$', csv.CourseEnrollmentCSV.as_view(), name='enrollment'), url(r'^enrollment/$', csv.CourseEnrollmentCSV.as_view(), name='enrollment'),
url(r'^enrollment/geography/$', csv.CourseEnrollmentByCountryCSV.as_view(), name='enrollment_geography'), url(r'^enrollment/geography/$', csv.CourseEnrollmentByCountryCSV.as_view(), name='enrollment_geography'),
url(r'^enrollment/demographics/age/$', url(r'^enrollment/demographics/age/$',
...@@ -98,15 +94,13 @@ CSV_URLS = patterns( ...@@ -98,15 +94,13 @@ CSV_URLS = patterns(
PROBLEM_PART_ID_PATTERN), PROBLEM_PART_ID_PATTERN),
csv.PerformanceAnswerDistributionCSV.as_view(), csv.PerformanceAnswerDistributionCSV.as_view(),
name='performance_answer_distribution'), name='performance_answer_distribution'),
) ]
LEARNER_URLS = patterns( LEARNER_URLS = [
'',
url(r'^$', learners.LearnersView.as_view(), name='learners'), url(r'^$', learners.LearnersView.as_view(), name='learners'),
) ]
COURSE_URLS = patterns( COURSE_URLS = [
'',
# Course homepage. This should be the entry point for other applications linking to the course. # Course homepage. This should be the entry point for other applications linking to the course.
url(r'^$', views.CourseHome.as_view(), name='home'), url(r'^$', views.CourseHome.as_view(), name='home'),
url(r'^enrollment/', include(ENROLLMENT_URLS, namespace='enrollment')), url(r'^enrollment/', include(ENROLLMENT_URLS, namespace='enrollment')),
...@@ -114,10 +108,9 @@ COURSE_URLS = patterns( ...@@ -114,10 +108,9 @@ COURSE_URLS = patterns(
url(r'^performance/', include(PERFORMANCE_URLS, namespace='performance')), url(r'^performance/', include(PERFORMANCE_URLS, namespace='performance')),
url(r'^csv/', include(CSV_URLS, namespace='csv')), url(r'^csv/', include(CSV_URLS, namespace='csv')),
url(r'^learners/', include(LEARNER_URLS, namespace='learners')), url(r'^learners/', include(LEARNER_URLS, namespace='learners')),
) ]
urlpatterns = patterns( urlpatterns = [
'',
url('^$', views.CourseIndex.as_view(), name='index'), url('^$', views.CourseIndex.as_view(), name='index'),
url(r'^{}/'.format(settings.COURSE_ID_PATTERN), include(COURSE_URLS)) url(r'^{}/'.format(settings.COURSE_ID_PATTERN), include(COURSE_URLS))
) ]
from django.conf.urls import patterns, url, include from django.conf.urls import url, include
urlpatterns = patterns( urlpatterns = [
'',
url(r'^v0/', include('learner_analytics_api.v0.urls', namespace='v0')) url(r'^v0/', include('learner_analytics_api.v0.urls', namespace='v0'))
) ]
...@@ -36,7 +36,8 @@ class LearnerAPITestMixin(UserTestCaseMixin, PermissionsTestMixin, SwitchMixin): ...@@ -36,7 +36,8 @@ class LearnerAPITestMixin(UserTestCaseMixin, PermissionsTestMixin, SwitchMixin):
no_permissions_status_code = None no_permissions_status_code = None
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls, *args, **kwargs):
super(LearnerAPITestMixin, cls).setUpClass(*args, **kwargs)
cls.toggle_switch('enable_learner_analytics', True) cls.toggle_switch('enable_learner_analytics', True)
def assert_response_equals(self, response, expected_status_code, expected_body=None): def assert_response_equals(self, response, expected_status_code, expected_body=None):
......
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url from django.conf.urls import url
from . import views from . import views
USERNAME_PATTERN = r'(?P<username>.+)' USERNAME_PATTERN = r'(?P<username>.+)'
urlpatterns = patterns( urlpatterns = [
'',
url(r'^learners/{}/$'.format(USERNAME_PATTERN), views.LearnerDetailView.as_view(), name='LearnerDetail'), url(r'^learners/{}/$'.format(USERNAME_PATTERN), views.LearnerDetailView.as_view(), name='LearnerDetail'),
url(r'^learners/$', views.LearnerListView.as_view(), name='LearnerList'), url(r'^learners/$', views.LearnerListView.as_view(), name='LearnerList'),
url(r'^engagement_timelines/{}/$'.format(USERNAME_PATTERN), url(r'^engagement_timelines/{}/$'.format(USERNAME_PATTERN),
...@@ -16,4 +15,4 @@ urlpatterns = patterns( ...@@ -16,4 +15,4 @@ urlpatterns = patterns(
url(r'^course_learner_metadata/{}/$'.format(settings.COURSE_ID_PATTERN), url(r'^course_learner_metadata/{}/$'.format(settings.COURSE_ID_PATTERN),
views.CourseLearnerMetadataView.as_view(), views.CourseLearnerMetadataView.as_view(),
name='CourseMetadata'), name='CourseMetadata'),
) ]
...@@ -24,9 +24,6 @@ path.append(DJANGO_ROOT) ...@@ -24,9 +24,6 @@ path.append(DJANGO_ROOT)
########## DEBUG CONFIGURATION ########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = False DEBUG = False
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END DEBUG CONFIGURATION ########## END DEBUG CONFIGURATION
...@@ -145,34 +142,30 @@ FIXTURE_DIRS = ( ...@@ -145,34 +142,30 @@ FIXTURE_DIRS = (
########## TEMPLATE CONFIGURATION ########## TEMPLATE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors # See: https://docs.djangoproject.com/en/dev/ref/settings/#templates
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': [
normpath(join(DJANGO_ROOT, 'templates')),
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug', 'django.template.context_processors.debug',
'django.core.context_processors.i18n', 'django.template.context_processors.i18n',
'django.core.context_processors.media', 'django.template.context_processors.media',
'django.core.context_processors.static', 'django.template.context_processors.static',
'django.core.context_processors.tz', 'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request', 'django.template.context_processors.request',
'core.context_processors.common', 'core.context_processors.common',
) ],
'debug': True,
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders }
TEMPLATE_LOADERS = ( }
'django.template.loaders.filesystem.Loader', ]
'django.template.loaders.app_directories.Loader',
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
TEMPLATE_DIRS = (
normpath(join(DJANGO_ROOT, 'templates')),
)
ALLOWED_INCLUDE_ROOTS = (
normpath(join(DJANGO_ROOT, 'templates')),
)
########## END TEMPLATE CONFIGURATION ########## END TEMPLATE CONFIGURATION
......
...@@ -8,9 +8,6 @@ from analytics_dashboard.settings.logger import get_logger_config ...@@ -8,9 +8,6 @@ from analytics_dashboard.settings.logger import get_logger_config
########## DEBUG CONFIGURATION ########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END DEBUG CONFIGURATION ########## END DEBUG CONFIGURATION
......
# pylint: disable=line-too-long,no-value-for-parameter # pylint: disable=line-too-long,no-value-for-parameter
import os import os
from django.conf.urls import patterns, include, url from django.conf.urls import include, url
from django.conf import settings from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.views import defaults
from django.views.generic import RedirectView from django.views.generic import RedirectView
# pylint suggests importing analytics_dashboard.core, which causes errors in our AMI # pylint suggests importing analytics_dashboard.core, which causes errors in our AMI
...@@ -18,8 +19,7 @@ js_info_dict = { ...@@ -18,8 +19,7 @@ js_info_dict = {
'packages': ('core', 'courses',), 'packages': ('core', 'courses',),
} }
urlpatterns = patterns( urlpatterns = [
'',
url(r'^$', views.LandingView.as_view(), name='landing'), url(r'^$', views.LandingView.as_view(), name='landing'),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
...@@ -35,26 +35,23 @@ urlpatterns = patterns( ...@@ -35,26 +35,23 @@ urlpatterns = patterns(
url(r'^accounts/logout_then_login/$', views.logout_then_login, name='logout_then_login'), url(r'^accounts/logout_then_login/$', views.logout_then_login, name='logout_then_login'),
url(r'^test/auto_auth/$', views.AutoAuth.as_view(), name='auto_auth'), url(r'^test/auto_auth/$', views.AutoAuth.as_view(), name='auto_auth'),
url(r'^announcements/', include('announcements.urls')), url(r'^announcements/', include('announcements.urls')),
) ]
urlpatterns += patterns( urlpatterns += [
'',
url(r'^api/learner_analytics/', include('learner_analytics_api.urls', namespace='learner_analytics_api')) url(r'^api/learner_analytics/', include('learner_analytics_api.urls', namespace='learner_analytics_api'))
) ]
if settings.DEBUG: # pragma: no cover if settings.DEBUG: # pragma: no cover
urlpatterns += patterns( urlpatterns += [
'', url(r'^403/$', defaults.permission_denied),
url(r'^403/$', 'django.views.defaults.permission_denied'), url(r'^404/$', defaults.page_not_found),
url(r'^404/$', 'django.views.defaults.page_not_found'), url(r'^500/$', defaults.server_error),
url(r'^500/$', 'django.views.defaults.server_error'),
url(r'^503/$', views.ServiceUnavailableView.as_view()), url(r'^503/$', views.ServiceUnavailableView.as_view()),
) ]
if os.environ.get('ENABLE_DJANGO_TOOLBAR', False): if os.environ.get('ENABLE_DJANGO_TOOLBAR', False):
import debug_toolbar # pylint: disable=import-error, wrong-import-position, wrong-import-order import debug_toolbar # pylint: disable=import-error, wrong-import-position, wrong-import-order
urlpatterns += patterns( urlpatterns += [
'',
url(r'^__debug__/', include(debug_toolbar.urls)), url(r'^__debug__/', include(debug_toolbar.urls)),
) ]
awesome-slugify==1.6.2 # GPLv3 awesome-slugify==1.6.2 # GPLv3
bpython==0.12 # MIT License bpython==0.12 # MIT License
Django==1.7.11 # BSD License Django==1.8.14 # BSD License
django-appconf==0.6 django-appconf==0.6
django-braces==1.2.2 # BSD django-braces==1.2.2 # BSD
django_compressor==1.4 # MIT django_compressor==2.0 # MIT
django-countries==3.1.1 # MIT django-countries==3.1.1 # MIT
django-libsass==0.2 # BSD django-libsass==0.7 # BSD
django-model-utils==1.5.0 # BSD django-model-utils==1.5.0 # BSD
djangorestframework==3.3.1 # BSD djangorestframework==3.3.1 # BSD
django-soapbox==1.1 # BSD django-soapbox==1.1 # BSD
...@@ -15,7 +15,7 @@ edx-django-release-util==0.0.3 # AGPLv3 ...@@ -15,7 +15,7 @@ edx-django-release-util==0.0.3 # AGPLv3
edx-rest-api-client>=1.5.0, <1.6.0 # Apache edx-rest-api-client>=1.5.0, <1.6.0 # Apache
# other versions cause a segment fault when running compression # other versions cause a segment fault when running compression
libsass==0.5.1 # MIT libsass==0.7.0 # MIT
logutils==0.3.3 # BSD logutils==0.3.3 # BSD
# TODO Remove this once https://github.com/omab/python-social-auth/pull/908 is released. # TODO Remove this once https://github.com/omab/python-social-auth/pull/908 is released.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment