Skip to content

Commit

Permalink
Add urls and view to process REST api requests
Browse files Browse the repository at this point in the history
  • Loading branch information
angonz committed Apr 19, 2024
1 parent 45656f1 commit 0ddf409
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
Empty file.
19 changes: 19 additions & 0 deletions panorama_openedx_backend/api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response


class GetDashboardEmbedUrl(APIView):

permission_classes = (IsAuthenticated,)

def get(self, request):

user = request.user

data = {
'embed_url': 'Hola Panorama!!',
'email': user.email,
}

return Response(data)
8 changes: 8 additions & 0 deletions panorama_openedx_backend/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ class PanoramaOpenedxBackendConfig(AppConfig):
name = 'panorama_openedx_backend'

plugin_app = {
'url_config': {
'lms.djangoapp': {
# 'namespace': 'panorama',
'regex': 'panorama/api/get-embed-url',
'relative_path': 'urls',
}
},

"settings_config": {
"lms.djangoapp": {
"common": {"relative_path": "settings.common"},
Expand Down
6 changes: 4 additions & 2 deletions panorama_openedx_backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
URLs for panorama_openedx_backend.
"""
from django.urls import re_path # pylint: disable=unused-import
from django.views.generic import TemplateView # pylint: disable=unused-import

from panorama_openedx_backend.api.views import GetDashboardEmbedUrl


urlpatterns = [
# TODO: Fill in URL patterns and views here.
# re_path(r'', TemplateView.as_view(template_name="panorama_openedx_backend/base.html")),
re_path(r'', GetDashboardEmbedUrl.as_view(), name='get dashboard embed url'),
]

0 comments on commit 0ddf409

Please sign in to comment.