def lti_select(self, request): """Get selectable content for LTI. Calling the endpoint returns a base URL for building a new markdown document LTI URL and a list of available documents. Parameters ---------- request : Type[django.http.request.HttpRequest] The request on the API endpoint Returns ------- Type[rest_framework.response.Response] HttpResponse carrying selectable content as a JSON object. """ new_url = build_absolute_uri_behind_proxy(self.request, "/lti/markdown-documents/") markdown_documents = serializers.MarkdownDocumentSelectLTISerializer( MarkdownDocument.objects.filter( playlist__id=request.user.token.payload.get("playlist_id")), many=True, context={ "request": self.request }, ).data return Response({ "new_url": new_url, "markdown_documents": markdown_documents, })
def lti_select(self, request): """Get selectable content for LTI. Calling the endpoint returns a base URL for building a new {{cookiecutter.model_lower}} LTI URL and a list of available {{cookiecutter.model_plural_lower}}. Parameters ---------- request : Type[django.http.request.HttpRequest] The request on the API endpoint Returns ------- Type[rest_framework.response.Response] HttpResponse carrying selectable content as a JSON object. """ new_url = build_absolute_uri_behind_proxy(self.request, "/lti/{{cookiecutter.model_url_part}}/") {{cookiecutter.model_plural_lower}} = serializers.{{cookiecutter.model}}SelectLTISerializer( {{cookiecutter.model}}.objects.filter( playlist__id=request.user.token.payload.get("playlist_id") ), many=True, context={"request": self.request}, ).data return Response( { "new_url": new_url, "{{cookiecutter.model_plural_lower}}": {{cookiecutter.model_plural_lower}}, } )
def get_lti_url(self, obj): """LTI Url of the Meeting. Parameters ---------- obj : Type[models.Document] The document that we want to serialize Returns ------- String the LTI url to be used by LTI consumers """ return build_absolute_uri_behind_proxy( self.context["request"], reverse("bbb:meeting_lti_view", args=[obj.id]), )
def get_lti_url(self, obj): """LTI Url of the {{cookiecutter.model}}. Parameters ---------- obj : Type[models.Document] The document that we want to serialize Returns ------- String the LTI url to be used by LTI consumers """ return build_absolute_uri_behind_proxy( self.context["request"], reverse("{{cookiecutter.app_name}}:{{cookiecutter.model_lower}}_lti_view", args=[obj.id]), )
def lti_select(self, request): """Get selectable content for LTI. Calling the endpoint returns a new uuid for a metting and a list of available meetings. Parameters ---------- request : Type[django.http.request.HttpRequest] The request on the API endpoint Returns ------- Type[rest_framework.response.Response] HttpResponse carrying selectable content as a JSON object. """ new_uuid = str(uuid.uuid4()) new_url = build_absolute_uri_behind_proxy( self.request, reverse("bbb:meeting_lti_view", args=[new_uuid]), ) meetings = serializers.MeetingSelectLTISerializer( Meeting.objects.filter( playlist__id=request.user.token.payload.get("playlist_id") ), many=True, context={"request": self.request}, ).data return Response( { "new_url": new_url, "meetings": meetings, } )