Files
edx-platform/lms/djangoapps/course_home_api/utils.py
Michael Terry c2033f9667 Small PLS courseware banner fixes
- Hide the submit-button CTA link to reset dates in the mobile
  app. They are working on their own solution.
- Don't show the dates_banner.html code in the courseware. It has
  new CTA banner support with updated wording.
2020-08-10 09:44:43 -04:00

24 lines
696 B
Python

"""Utility functions for course home"""
from django.conf import settings
def get_microfrontend_url(course_key, view_name=None):
"""
Takes in a course key and view name, returns the appropriate course home mfe route
"""
mfe_link = '{}/course/{}'.format(settings.LEARNING_MICROFRONTEND_URL, course_key)
if view_name:
mfe_link += '/{}'.format(view_name)
return mfe_link
def is_request_from_learning_mfe(request):
"""
Returns whether the given request was made by the frontend-app-learning MFE.
"""
return (settings.LEARNING_MICROFRONTEND_URL and
request.META.get('HTTP_REFERER', '').startswith(settings.LEARNING_MICROFRONTEND_URL))