diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index 67bc36e981..ff86cf8bcf 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -103,6 +103,16 @@ def open_source_footer_context_processor(request): ) +def microsite_footer_context_processor(request): + """ + Checks the site name to determine whether to use the edX.org footer or the Open Source Footer. + """ + return dict( + [ + ("IS_REQUEST_IN_MICROSITE", microsite.is_request_in_microsite()) + ] + ) + def render_to_string(template_name, dictionary, context=None, namespace='main'): # see if there is an override template defined in the microsite diff --git a/lms/envs/common.py b/lms/envs/common.py index 46feaa19f6..0cac7ae69d 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -380,6 +380,9 @@ TEMPLATE_CONTEXT_PROCESSORS = ( # Shoppingcart processor (detects if request.user has a cart) 'shoppingcart.context_processor.user_has_cart_context_processor', + + # Allows the open edX footer to be leveraged in Django Templates. + 'edxmako.shortcuts.microsite_footer_context_processor', ) # use the ratelimit backend to prevent brute force attacks diff --git a/lms/templates/main_django.html b/lms/templates/main_django.html index 9de60bfc0d..bc47156e58 100644 --- a/lms/templates/main_django.html +++ b/lms/templates/main_django.html @@ -40,7 +40,9 @@ {% block body %}{% endblock %} {% block bodyextra %}{% endblock %} - {% if IS_EDX_DOMAIN %} + {% if IS_REQUEST_IN_MICROSITE %} + {# For now we don't support overriden Django templates in microsites. Leave footer blank for now which is better than saying Edx.#} + {% elif IS_EDX_DOMAIN %} {% if ENABLE_NEW_EDX_FOOTER %} {% include "footer-edx-new.html" %} {% else %}