本文整理汇总了Python中microsite_configuration.middleware.MicrositeConfiguration.match_university方法的典型用法代码示例。如果您正苦于以下问题:Python MicrositeConfiguration.match_university方法的具体用法?Python MicrositeConfiguration.match_university怎么用?Python MicrositeConfiguration.match_university使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类microsite_configuration.middleware.MicrositeConfiguration
的用法示例。
在下文中一共展示了MicrositeConfiguration.match_university方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from microsite_configuration.middleware import MicrositeConfiguration [as 别名]
# 或者: from microsite_configuration.middleware.MicrositeConfiguration import match_university [as 别名]
def index(request):
"""
Redirects to main page -- info page if user authenticated, or marketing if not
"""
if settings.COURSEWARE_ENABLED and request.user.is_authenticated():
return redirect(reverse("dashboard"))
if settings.FEATURES.get("AUTH_USE_MIT_CERTIFICATES"):
from external_auth.views import ssl_login
return ssl_login(request)
enable_mktg_site = MicrositeConfiguration.get_microsite_configuration_value(
"ENABLE_MKTG_SITE", settings.FEATURES.get("ENABLE_MKTG_SITE", False)
)
if enable_mktg_site:
return redirect(settings.MKTG_URLS.get("ROOT"))
university = MicrositeConfiguration.match_university(request.META.get("HTTP_HOST"))
# keep specialized logic for Edge until we can migrate over Edge to fully use
# microsite definitions
if university == "edge":
context = {"suppress_toplevel_navigation": True}
return render_to_response("university_profile/edge.html", context)
# we do not expect this case to be reached in cases where
# marketing and edge are enabled
return student.views.index(request, user=request.user)