Commit d78b9bde by Clinton Blackburn

WIP: Added API documentation

parent b85b793c
""" API v0 views. """ """ API v0 views. """
import base64 import base64
import logging import logging
import os
from path import Path as path
from six import text_type
import os
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model
from django.views.decorators.csrf import csrf_exempt
from django.core.files import File from django.core.files import File
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from path import Path as path
from rest_framework import status from rest_framework import status
from rest_framework.exceptions import AuthenticationFailed from rest_framework.exceptions import AuthenticationFailed
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response from rest_framework.response import Response
from user_tasks.models import UserTaskArtifact, UserTaskStatus from rest_framework.views import APIView
from six import text_type
from student.auth import has_course_author_access from user_tasks.models import UserTaskStatus
from contentstore.storage import course_import_export_storage from contentstore.storage import course_import_export_storage
from contentstore.tasks import CourseImportTask, import_olx from contentstore.tasks import CourseImportTask, import_olx
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
from student.auth import has_course_author_access
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -42,7 +36,7 @@ class CourseImportExportViewMixin(DeveloperErrorViewMixin): ...@@ -42,7 +36,7 @@ class CourseImportExportViewMixin(DeveloperErrorViewMixin):
raise AuthenticationFailed raise AuthenticationFailed
class CourseImportView(CourseImportExportViewMixin, GenericAPIView): class CourseImportView(CourseImportExportViewMixin, APIView):
""" """
**Use Case** **Use Case**
......
...@@ -910,6 +910,7 @@ INSTALLED_APPS = [ ...@@ -910,6 +910,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'djcelery', 'djcelery',
'method_override', 'method_override',
'rest_framework',
# Common views # Common views
'openedx.core.djangoapps.common_views', 'openedx.core.djangoapps.common_views',
......
...@@ -4,6 +4,7 @@ from django.conf.urls.static import static ...@@ -4,6 +4,7 @@ from django.conf.urls.static import static
from django.contrib.admin import autodiscover as django_autodiscover from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from ratelimitbackend import admin from ratelimitbackend import admin
from rest_framework.documentation import include_docs_urls
from cms.djangoapps.contentstore.views.organization import OrganizationListView from cms.djangoapps.contentstore.views.organization import OrganizationListView
...@@ -75,6 +76,7 @@ urlpatterns = patterns( ...@@ -75,6 +76,7 @@ urlpatterns = patterns(
# For redirecting to help pages. # For redirecting to help pages.
url(r'^help_token/', include('help_tokens.urls')), url(r'^help_token/', include('help_tokens.urls')),
url(r'^api/', include('cms.djangoapps.api.urls', namespace='api')), url(r'^api/', include('cms.djangoapps.api.urls', namespace='api')),
url(r'^api-docs/', include_docs_urls(title='Studio API', public=True)),
) )
# restful api # restful api
......
...@@ -10,7 +10,7 @@ from django.utils.decorators import method_decorator ...@@ -10,7 +10,7 @@ from django.utils.decorators import method_decorator
from django.views.generic import View from django.views.generic import View
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from rest_framework.generics import GenericAPIView from rest_framework.views import APIView
from course_modes.models import CourseMode from course_modes.models import CourseMode
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
...@@ -40,7 +40,7 @@ class EnrollmentSupportView(View): ...@@ -40,7 +40,7 @@ class EnrollmentSupportView(View):
}) })
class EnrollmentSupportListView(GenericAPIView): class EnrollmentSupportListView(APIView):
""" """
Allows viewing and changing learner enrollments by support Allows viewing and changing learner enrollments by support
staff. staff.
......
...@@ -10,6 +10,7 @@ from django.contrib.admin import autodiscover as django_autodiscover ...@@ -10,6 +10,7 @@ from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from ratelimitbackend import admin from ratelimitbackend import admin
from rest_framework.documentation import include_docs_urls
from courseware.views.index import CoursewareIndex from courseware.views.index import CoursewareIndex
from courseware.views.views import CourseTabView, EnrollStaffView, StaticCourseTabView from courseware.views.views import CourseTabView, EnrollStaffView, StaticCourseTabView
...@@ -119,6 +120,7 @@ urlpatterns = ( ...@@ -119,6 +120,7 @@ urlpatterns = (
url(r'^dashboard/', include('learner_dashboard.urls')), url(r'^dashboard/', include('learner_dashboard.urls')),
url(r'^api/experiments/', include('experiments.urls', namespace='api_experiments')), url(r'^api/experiments/', include('experiments.urls', namespace='api_experiments')),
url(r'^api-docs/', include_docs_urls(title='LMS API', public=False)),
) )
# TODO: This needs to move to a separate urls.py once the student_account and # TODO: This needs to move to a separate urls.py once the student_account and
......
...@@ -8,6 +8,8 @@ from .helpers import is_comprehensive_theming_enabled ...@@ -8,6 +8,8 @@ from .helpers import is_comprehensive_theming_enabled
from .views import ThemingAdministrationFragmentView from .views import ThemingAdministrationFragmentView
urlpatterns = []
if is_comprehensive_theming_enabled(): if is_comprehensive_theming_enabled():
urlpatterns = [ urlpatterns = [
url( url(
......
...@@ -11,6 +11,7 @@ bleach==1.4 ...@@ -11,6 +11,7 @@ bleach==1.4
html5lib==0.999 html5lib==0.999
boto==2.39.0 boto==2.39.0
celery==3.1.18 celery==3.1.18
coreapi==2.3.3
cryptography==1.5.3 cryptography==1.5.3
cssselect==0.9.1 cssselect==0.9.1
dealer==2.0.4 dealer==2.0.4
......
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