Add barebones toggles endpoint for development.

This commit is contained in:
Diana Huang
2020-08-12 11:45:23 -04:00
parent 10ac2780de
commit 0827a3749d
3 changed files with 27 additions and 0 deletions

View File

@@ -144,6 +144,7 @@ urlpatterns = [
url(r'^api/commerce/', include(('commerce.api.urls', 'lms.djangoapps.commerce'), namespace='commerce_api')),
url(r'^api/credit/', include('openedx.core.djangoapps.credit.urls')),
url(r'^api/toggles/', include('openedx.core.djangoapps.waffle_utils.urls')),
url(r'^rss_proxy/', include('rss_proxy.urls')),
url(r'^api/organizations/', include('organizations.urls', namespace='organizations')),

View File

@@ -0,0 +1,8 @@
""" URL definitions for waffle utils. """
from django.conf.urls import url
from openedx.core.djangoapps.waffle_utils.views import ToggleStateView
urlpatterns = [
url(r'^state/', ToggleStateView.as_view(), name="toggle_state"),
]

View File

@@ -0,0 +1,18 @@
""" Views that we will use to view toggle state in edx-platform. """
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.permissions import IsStaff
from rest_framework.authentication import SessionAuthentication
from rest_framework import permissions, views
from rest_framework.response import Response
class ToggleStateView(views.APIView):
"""
An endpoint for displaying the state of toggles in edx-platform.
"""
authentication_classes = (JwtAuthentication, SessionAuthentication,)
permission_classes = (permissions.IsAuthenticated, IsStaff,)
def get(self, request):
return Response("Hello")