本文整理匯總了Python中django.contrib.flatpages.views.flatpage方法的典型用法代碼示例。如果您正苦於以下問題:Python views.flatpage方法的具體用法?Python views.flatpage怎麽用?Python views.flatpage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.flatpages.views
的用法示例。
在下文中一共展示了views.flatpage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process_response
# 需要導入模塊: from django.contrib.flatpages import views [as 別名]
# 或者: from django.contrib.flatpages.views import flatpage [as 別名]
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a flatpage for non-404 responses.
try:
return flatpage(request, request.path_info)
# Return the original response if any errors happened. Because this
# is a middleware, we can't assume the errors will be caught elsewhere.
except Http404:
return response
except Exception:
if settings.DEBUG:
raise
return response